@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=Tajawal:wght@400;500;700&family=Almarai:wght@400;700&family=Changa:wght@400;600&family=El+Messiri:wght@400;600;700&family=Amiri:wght@400;700&family=Reem+Kufi:wght@400;600;700&family=Noto+Kufi+Arabic:wght@400;700&family=Noto+Naskh+Arabic:wght@400;600;700&family=Montserrat:wght@400;600;700&family=Poppins:wght@400;600;700&family=Oswald:wght@400;700&family=Roboto:wght@400;500;700&family=Bebas+Neue&family=Inter:wght@400;600;700&family=Playfair+Display:wght@600;700&display=swap');

* { box-sizing: border-box; }

.pj-app { 
    display: flex; 
    height: 850px; 
    background: #fff; 
    border: 1px solid #ddd; 
    border-radius: 12px; 
    overflow: hidden; 
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pj-sidebar { 
    width: 320px; 
    background: #fafafa; 
    border-right: 1px solid #eee; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto;
    overflow-x: hidden;
}

.rtl { direction: rtl; } 
.ltr { direction: ltr; }

.pj-brand { 
    padding: 25px; 
    color: #ff4757; 
    font-weight: 800; 
    font-size: 24px; 
    border-bottom: 2px solid #eee; 
    margin: 0;
}

.pj-group { 
    padding: 20px; 
    border-bottom: 1px solid #eee; 
}

.pj-group label { 
    display: block; 
    font-weight: 600; 
    font-size: 12px; 
    color: #666; 
    margin-bottom: 12px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

.pj-group select,
.pj-group input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    font-size: 14px;
}

.pj-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
}

.pj-grid button { 
    background: #fff; 
    border: 1px solid #ddd; 
    padding: 12px 8px; 
    border-radius: 8px; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    gap: 4px; 
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pj-grid button:hover { 
    border-color: #ff4757; 
    color: #ff4757;
    background: #fff5f5;
}

.pj-grid button:active {
    transform: scale(0.95);
}

.pj-align-row, .pj-layer-row { 
    display: flex; 
    gap: 5px; 
    margin-bottom: 15px; 
}

.pj-align-row button, .pj-layer-row button { 
    flex: 1; 
    padding: 10px; 
    border: 1px solid #ddd; 
    background: #fff; 
    cursor: pointer; 
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
}

.pj-align-row button:hover, .pj-layer-row button:hover {
    border-color: #ff4757;
    color: #ff4757;
}

.pj-danger { 
    border-color: #ff4757 !important; 
    color: #fff !important;
    background: #ff4757 !important;
}

.pj-danger:hover {
    background: #e84345 !important;
}

.pj-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.pj-slider-row span {
    font-weight: 600;
    font-size: 12px;
    min-width: 70px;
}

.pj-slider-row input[type="range"] {
    flex: 1;
}

.pj-color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.pj-color-picker-row label {
    margin: 0;
    text-transform: none;
    font-size: 12px;
    font-weight: 600;
    min-width: 80px;
}

.pj-color-picker-row input[type="color"] {
    width: 50px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

.pj-main { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    background: #f1f2f6; 
    position: relative; 
}

.pj-topbar { 
    padding: 15px 25px; 
    background: #fff; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #eee; 
}

.pj-history {
    display: flex;
    gap: 8px;
}

.pj-history button {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pj-history button:hover {
    border-color: #ff4757;
    color: #ff4757;
}

.pj-history button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pj-status { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-weight: 600; 
    background: #eee; 
    padding: 8px 16px; 
    border-radius: 20px; 
    font-size: 13px; 
}

.dot { 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
    background: #ccc;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.pj-status.good { 
    color: #2ed573; 
    background: #e7fcf0; 
}

.pj-status.good .dot { 
    background: #2ed573; 
}

.pj-status.warning { 
    color: #ffa502; 
    background: #fff9e6; 
}

.pj-status.warning .dot { 
    background: #ffa502; 
}

.pj-status.danger {
    color: #ff4757;
    background: #ffeaea;
}

.pj-status.danger .dot {
    background: #ff4757;
}

.pj-stage { 
    flex: 1; 
    overflow: auto; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 40px; 
    background: linear-gradient(135deg, #f5f5f5 0%, #efefef 100%);
}

#pj-canvas-wrap { 
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); 
    background: #fff; 
    line-height: 0;
    position: relative;
    border-radius: 4px;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

#pj-canvas {
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    -ms-interpolation-mode: nearest-neighbor;
}

canvas {
    display: block;
}

.pj-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.pj-safe-zone {
    border: 2px dashed #2ed573;
    position: absolute;
    pointer-events: none;
}

.pj-danger-zone {
    border: 2px dashed #ff4757;
    position: absolute;
    pointer-events: none;
}

.pj-footer { 
    padding: 20px; 
    background: #fff; 
    border-top: 1px solid #eee; 
    display: flex; 
    justify-content: space-between;
    align-items: center;
}

.pj-btn-primary { 
    background: #ff4757; 
    color: #fff; 
    border: none; 
    padding: 14px 40px; 
    border-radius: 30px; 
    font-size: 16px; 
    font-weight: 700; 
    cursor: pointer;
    transition: all 0.3s ease;
}

.pj-btn-primary:hover {
    background: #e84345;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.pj-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pj-ghost-btn { 
    background: transparent; 
    border: none; 
    color: #999; 
    cursor: pointer;
    font-size: 16px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.pj-ghost-btn:hover {
    color: #333;
}

@media (max-width: 1024px) {
    .pj-app { height: auto; }
    .pj-sidebar { width: 280px; }
}

@media (max-width: 768px) {
    .pj-app { flex-direction: column; }
    .pj-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #eee; }
}
