/* style.css - Enhanced Glass OS (v1.1) */
:root {
    /* الخلطة السرية للزجاج: شفافية 70% + تشبع لوني + تمويه قوي */
    --glass-bg: rgba(255, 255, 255, 0.75); 
    --glass-border: 1px solid rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --primary-color: #2563eb;
    --text-color: #1e293b;
    --font-main: 'Cairo', sans-serif;
}

* { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }

body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    font-family: var(--font-main); overflow: hidden;
}

/* خلفية "Mesh Gradient" لإبراز الزجاج */
.wallpaper {
    position: fixed; inset: 0; z-index: -1;
    background-color: #4158D0;
    background-image: linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%);
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* شعار المشروع العائم */
.app-brand {
    position: absolute; top: 20px; right: 20px;
    z-index: 50; /* خلف النوافذ لكن فوق الخلفية */
    text-align: right;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.app-brand h1 { margin: 0; font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; }
.app-brand span { font-size: 0.9rem; opacity: 0.9; font-weight: 400; }

/* تحسين الزجاج */
.glass-panel {
    background: var(--glass-bg);
    /* هذا هو السر: زيادة التشبع (Saturate) تجعل الألوان خلف الزجاج أزهى */
    backdrop-filter: saturate(180%) blur(16px); 
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
}

/* مساحة العمل */
#workspace { position: relative; width: 100%; height: 100%; pointer-events: none; }

/* النوافذ */
.window {
    position: absolute; top: 0; left: 0; /* نقطة البداية للحسابات */
    min-width: 320px; min-height: 220px;
    display: flex; flex-direction: column;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.1s;
    /* حركة ناعمة عند الفتح */
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9) translate(var(--x, 0), var(--y, 0)); }
    to { opacity: 1; transform: scale(1) translate(var(--x, 0), var(--y, 0)); }
}

.window.hidden { display: none; }

.window-header {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex; justify-content: space-between; align-items: center;
    cursor: grab;
}
.window-header:active { cursor: grabbing; }

.win-title { font-weight: 700; color: var(--text-color); display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }

.btn-close {
    background: #ff5f56; border: none; width: 20px; height: 20px; border-radius: 50%;
    color: transparent; transition: 0.2s; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.window-header:hover .btn-close { color: rgba(0,0,0,0.6); } /* إظهار الـ X عند التحويم فقط مثل ماك */

.window-body { padding: 20px; flex: 1; overflow-y: auto; color: var(--text-color); }

/* الشريط السفلي (Dock) */
#dock {
    position: fixed; bottom: 25px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 12px; padding: 12px 20px;
    pointer-events: auto; z-index: 1000;
    border-radius: 24px;
    /* زجاج أكثر كثافة للشريط */
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.dock-item {
    width: 55px; height: 55px; border-radius: 16px;
    background: rgba(255,255,255,0.6);
    display: flex; justify-content: center; align-items: center;
    font-size: 26px; color: #4338ca;
    cursor: pointer; transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.dock-item:hover { transform: scale(1.15) translateY(-10px); background: white; color: #2563eb; }
.dock-separator { width: 1px; background: rgba(0,0,0,0.15); margin: 0 4px; height: 30px; align-self: center; }

/* أزرار وتفاصيل */
.btn-glass {
    padding: 10px 24px; border: 1px solid rgba(255,255,255,0.8);
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.4));
    border-radius: 12px; cursor: pointer; font-family: inherit; font-weight: 700; color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: 0.2s;
}
.btn-glass:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); background: white; }
.timer-display { font-size: 4rem; font-weight: 800; color: #333; margin: 10px 0 20px 0; font-variant-numeric: tabular-nums; }

/* ================= Timer Skins ================= */
.flex-center-col {
    display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;
}

.timer-wrapper { position: relative; width: 220px; height: 220px; margin-bottom: 30px; }

/* SVG Ring Styles */
.timer-ring { transform: rotate(-90deg); /* البدء من الأعلى */ }
.ring-bg { fill: none; stroke: rgba(0,0,0,0.05); stroke-width: 8; }
.ring-progress {
    fill: none;
    stroke: #2563eb; /* اللون الأساسي */
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 628; /* محيط الدائرة 2*PI*r */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
    filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.5)); /* توهج */
}
/* أضف هذا الكود في قسم Timer Skins أو استبدل القديم */

:root {
    /* اللون الافتراضي للمؤقت */
    --timer-color: #2563eb; 
}

.timer-wrapper { position: relative; width: 220px; height: 220px; margin: 10px auto; }

.ring-progress {
    fill: none;
    stroke: var(--timer-color); /* <--- أصبح ديناميكياً الآن */
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 628;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s, filter 0.3s;
    filter: drop-shadow(0 0 5px var(--timer-color)); /* توهج بنفس لون المؤقت */
}

/* تنسيق أزرار التعديل الدقيق (+ / -) */
.time-adjusters {
    display: flex; gap: 40px; opacity: 0; transition: 0.2s;
}
.timer-content:hover .time-adjusters { opacity: 1; } /* تظهر عند التحويم فقط */
/* للجوال: تظهر دائماً */
@media (max-width: 768px) { .time-adjusters { opacity: 0.5; } }

.time-adjusters button {
    background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 1.2rem; padding: 0 10px;
}
.time-adjusters button:hover { color: var(--timer-color); transform: scale(1.2); }

/* أزرار الأوقات الجاهزة (Presets) */
.timer-presets { display: flex; gap: 8px; margin-bottom: 15px; }
.timer-presets button {
    background: rgba(255,255,255,0.5); border: 1px solid rgba(0,0,0,0.1);
    padding: 5px 12px; border-radius: 20px; font-size: 0.85rem; cursor: pointer;
    color: #475569; transition: 0.2s;
}
.timer-presets button:hover { background: white; color: var(--timer-color); border-color: var(--timer-color); }

.time-display { font-variant-numeric: tabular-nums; letter-spacing: 2px; }

/* تأثير الخطر */
.timer-danger .ring-progress {
    stroke: #ef4444 !important; filter: drop-shadow(0 0 15px red);
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

/* حالة الطوارئ (آخر 10 ثواني) */
.timer-danger .ring-progress { stroke: #ef4444; filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6)); }

.timer-content {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}

.time-display {
    font-size: 3.5rem; font-weight: 800; color: var(--text-color);
    line-height: 1; outline: none; border-bottom: 2px solid transparent;
}
.time-display:focus { border-bottom: 2px solid var(--primary-color); color: var(--primary-color); }
.time-label { font-size: 0.9rem; color: #64748b; margin-top: 5px; }

/* Controls Bar */
.timer-controls-bar {
    display: flex; gap: 15px; align-items: center;
    background: rgba(255,255,255,0.5); padding: 10px 20px; border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.btn-control {
    border: none; border-radius: 50%; width: 50px; height: 50px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; cursor: pointer; transition: 0.2s;
}
.main-btn {
    width: 60px; height: 60px; font-size: 1.5rem;
    background: var(--primary-color); color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}
.main-btn:hover { transform: scale(1.1); box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4); }
.sec-btn { background: white; color: #64748b; }
.sec-btn:hover { background: #f1f5f9; color: #333; }
/* =========================================
   Mobile Optimization (Vertical Stack)
   ========================================= */
/* =========================================
   Mobile Optimization (Full Screen Focus)
   ========================================= */
@media (max-width: 768px) {
    .app-brand { top: 15px; right: 15px; z-index: 1; }
    
    /* الشريط السفلي */
    #dock {
        width: 90%; bottom: 15px; border-radius: 20px;
        padding: 10px; justify-content: space-between;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(20px);
        transition: transform 0.3s;
    }
    
    /* إخفاء الشريط السفلي عند فتح نافذة */
    body.window-open #dock { transform: translateY(150%); }

    /* النافذة: ملء الشاشة تماماً */
    .window {
        position: fixed !important;
        inset: 0 !important; /* Top, Right, Bottom, Left = 0 */
        width: 100% !important; height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important; border: none;
        transform: translateY(100%); /* البداية خارج الشاشة */
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        z-index: 2000 !important; /* فوق كل شيء */
        display: flex; flex-direction: column;
        background: #f8fafc; /* خلفية صلبة لعدم تداخل النصوص */
    }
    
    .window:not(.hidden) { transform: translateY(0) !important; }

    /* رأس النافذة في الجوال */
    .window-header {
        padding: 15px 20px; background: white;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    .window-header .btn-close {
        background: #f1f5f9; color: #ef4444; width: 35px; height: 35px;
        font-size: 1.2rem;
    }
    .win-title { font-size: 1.3rem; }
    
    .window-body { padding: 20px; overflow-y: auto; }
}
/* تنسيق الساعة الرقمية الجديد (لحل مشكلة التداخل والعكس) */
.digital-clock-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    direction: ltr; /* هام جداً: تثبيت الاتجاه يسار-يمين للأرقام حتى في الصفحة العربية */
    z-index: 10; /* ضمان أنه فوق الدائرة */
    position: relative;
}

.digit-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.digit-column span {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
    min-width: 80px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.colon {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-color);
    margin-top: -10px;
}

/* أزرار التحكم الصغيرة (+ / -) */
.digit-column button {
    background: rgba(255,255,255,0.5);
    border: none;
    color: var(--text-color);
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
    opacity: 0; /* مخفية افتراضياً */
}

/* تظهر عند التحويم على الدائرة أو دائماً في الجوال */
.timer-wrapper:hover .digit-column button { opacity: 1; }
@media (max-width: 768px) { .digit-column button { opacity: 1; background: rgba(0,0,0,0.05); } }

.digit-column button:hover { background: var(--timer-color); color: white; transform: scale(1.2); }
.digit-column button:active { transform: scale(0.9); }

/* نافذة الإعدادات المنبثقة */
.settings-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    border: 1px solid rgba(0,0,0,0.1);
}
.settings-overlay h4 { margin-top: 0; margin-bottom: 15px; color: var(--primary-color); }
.setting-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; font-size: 0.9rem;
}
.setting-row input[type="number"] {
    width: 60px; padding: 5px; border-radius: 8px; border: 1px solid #ddd; text-align: center;
}

/* Switch Toggle Style */
.switch { position: relative; display: inline-block; width: 40px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--timer-color); }
input:checked + .slider:before { transform: translateX(16px); }

.timer-ring { transform: rotate(-90deg); pointer-events: none; /* السماح بالنقر عبر الحلقة */ }
/* كلاس عام لإخفاء أي عنصر */
.hidden {
    display: none !important;
}