* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Almarai', sans-serif;
    background: #0a0e27;
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border-radius: 35px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Main Layout Structure */
.main-layout {
    display: flex;
    gap: 40px;
    padding-top: 20px;
    position: relative; /* Anchor for absolute sidebar on mobile */
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px); /* Limit height on desktop/tablet views */
    overflow-y: auto; /* Enable scrolling for long filter lists (Calculator fix) */
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.content-display {
    flex-grow: 1;
    min-width: 0;
}

.title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.5), 0 0 80px rgba(168, 85, 247, 0.3);
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899, #f97316);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 5s ease-in-out infinite;
    letter-spacing: -1px;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 1.4rem;
    font-weight: 400;
    opacity: 0.95;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    color: #c7d2fe;
    letter-spacing: 0.5px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin: 35px 0 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 15px 15px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.2);
}

.stat-number {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #c7d2fe;
    font-weight: 500;
    opacity: 0.9;
}

.videos-section {
    margin-bottom: 60px;
    animation: fadeInUp 0.8s ease forwards;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: white;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.2rem;
    color: #c7d2fe;
    opacity: 0.9;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 35px;
    padding: 20px 0;
}

/* New Video Card Styles for display fix */
.video-thumbnail {
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
    border-radius: 25px 25px 0 0;
    margin-bottom: 0;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease;
    z-index: 5;
}

.video-card:hover .play-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.play-button {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: #6366f1;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.video-card:hover .play-button {
    transform: scale(1.1);
}

.video-duration {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    z-index: 10;
}

.video-info {
    padding: 20px 25px 25px; /* Added internal padding */
    text-align: right;
}

.video-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    line-height: 1.4;
}

.video-description {
    font-size: 1rem;
    color: #c7d2fe;
    opacity: 0.8;
    margin-bottom: 12px;
}

.video-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: #a8a29e;
    margin-bottom: 15px;
    justify-content: flex-end;
}

.video-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.action-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.watch-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.share-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #c7d2fe;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.watch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5);
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
/* End of New Video Card Styles */

.app-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(30px);
    border-radius: 30px;
    padding: 30px 25px; /* Reduced vertical padding */
    text-align: center;
    box-shadow: 
        0 25px 50px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-card:nth-child(1) { animation-delay: 0.1s; }
.app-card:nth-child(2) { animation-delay: 0.15s; }
.app-card:nth-child(3) { animation-delay: 0.2s; }
.app-card:nth-child(4) { animation-delay: 0.25s; }
.app-card:nth-child(5) { animation-delay: 0.3s; }
.app-card:nth-child(6) { animation-delay: 0.35s; }
.app-card:nth-child(7) { animation-delay: 0.4s; }
.app-card:nth-child(8) { animation-delay: 0.45s; }
.app-card:nth-child(9) { animation-delay: 0.5s; }
.app-card:nth-child(10) { animation-delay: 0.55s; }
.app-card:nth-child(11) { animation-delay: 0.6s; }
.app-card:nth-child(12) { animation-delay: 0.65s; }
.app-card:nth-child(13) { animation-delay: 0.7s; }
.app-card:nth-child(14) { animation-delay: 0.75s; }
.app-card:nth-child(15) { animation-delay: 0.8s; }
.app-card:nth-child(16) { animation-delay: 0.85s; }
.app-card:nth-child(17) { animation-delay: 0.9s; }
.app-card:nth-child(18) { animation-delay: 0.95s; }
.app-card:nth-child(19) { animation-delay: 1s; }
.app-card:nth-child(20) { animation-delay: 1.05s; }
.app-card:nth-child(21) { animation-delay: 1.1s; }
.app-card:nth-child(22) { animation-delay: 1.15s; }
.app-card:nth-child(23) { animation-delay: 1.2s; }
.app-card:nth-child(24) { animation-delay: 1.25s; }
.app-card:nth-child(25) { animation-delay: 1.3s; }
.app-card:nth-child(26) { animation-delay: 1.35s; }
.app-card:nth-child(27) { animation-delay: 1.4s; }
.app-card:nth-child(28) { animation-delay: 1.45s; }
.app-card:nth-child(29) { animation-delay: 1.5s; }
.app-card:nth-child(30) { animation-delay: 1.55s; }

.video-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(30px);
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 
        0 25px 50px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
    cursor: pointer;
    padding: 0; /* Remove padding from container to allow thumbnail to fill */
}

.app-card.hidden {
    display: none;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: translateX(-100%) rotate(45deg);
    transition: transform 0.8s;
}

.app-card:hover::before {
    transform: translateX(100%) rotate(45deg);
}

.app-card:hover {
    transform: translateY(-20px) scale(1.03);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 
        0 40px 80px rgba(0,0,0,0.3),
        0 0 50px rgba(99, 102, 241, 0.2),
        inset 0 1px 0 rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.2);
}

.app-card:active {
    transform: translateY(-15px) scale(1.01);
}

.app-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 25px; /* Reduced margin */
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem; /* Reduced icon font size */
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 
        0 15px 35px rgba(102, 126, 234, 0.4),
        inset 0 -4px 10px rgba(0,0,0,0.2),
        inset 0 2px 10px rgba(255,255,255,0.3);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.app-icon::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.2));
    border-radius: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

.app-card:hover .app-icon {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 
        0 20px 50px rgba(102, 126, 234, 0.5),
        0 0 30px rgba(102, 126, 234, 0.3),
        inset 0 -4px 10px rgba(0,0,0,0.2),
        inset 0 2px 10px rgba(255,255,255,0.4);
}

.app-card:hover .app-icon::after {
    opacity: 1;
}

.ai-icon { 
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.security-icon { 
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.labs-icon { 
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    box-shadow: 0 8px 25px rgba(0, 210, 255, 0.3);
}

.tools-icon { 
    background: linear-gradient(135deg, #11998e, #38ef7d);
    box-shadow: 0 8px 25px rgba(17, 153, 142, 0.3);
}

.tasks-icon { 
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    box-shadow: 0 8px 25px rgba(255, 234, 167, 0.4);
}

.cards-icon { 
    background: linear-gradient(135deg, #fd79a8, #e84393);
    box-shadow: 0 8px 25px rgba(253, 121, 168, 0.3);
}

.knowledge-icon { 
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.3);
}

.easytube-icon { 
    background: linear-gradient(135deg, #fd79a8, #fdcb6e);
    box-shadow: 0 8px 25px rgba(253, 121, 168, 0.3);
}

.portal-analysis-icon { 
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    box-shadow: 0 8px 25px rgba(116, 185, 255, 0.3);
}

.occasion-cards-icon { 
    background: linear-gradient(135deg, #fd79a8, #ff7675);
    box-shadow: 0 8px 25px rgba(253, 121, 168, 0.3);
}

.magazine-design-icon { 
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    box-shadow: 0 8px 25px rgba(162, 155, 254, 0.3);
}

.text-formatter-icon { 
    background: linear-gradient(135deg, #00b894, #00a085);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.3);
}

.clickifi-icon { 
    background: linear-gradient(135deg, #fdcb6e, #e17055);
    box-shadow: 0 8px 25px rgba(253, 203, 110, 0.3);
}

.educational-resources-icon { 
    background: linear-gradient(135deg, #00cec9, #55a3ff);
    box-shadow: 0 8px 25px rgba(0, 206, 201, 0.3);
}

.academic-path-icon { 
    background: linear-gradient(135deg, #ff7675, #fd79a8);
    box-shadow: 0 8px 25px rgba(255, 118, 117, 0.3);
}

.teacher-tools-analysis-icon { 
    background: linear-gradient(135deg, #00b894, #55efc4);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.3);
}

.lesson-creator-icon { 
    background: linear-gradient(135deg, #a29bfe, #fd79a8);
    box-shadow: 0 8px 25px rgba(162, 155, 254, 0.3);
}

.schedule-manager-icon { 
    background: linear-gradient(135deg, #74b9ff, #a29bfe);
    box-shadow: 0 8px 25px rgba(116, 185, 255, 0.3);
}

.course-creator-icon { 
    background: linear-gradient(135deg, #f39c12, #e67e22);
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.3);
}

.mulhim-icon { 
    background: linear-gradient(135deg, #0ea5e9, #22d3ee);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.3);
}

.behavior-tracker-icon { 
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 8px 25px rgba(16,185,129,0.3);
}

.gpa-calculator-icon { 
    background: linear-gradient(135deg, #56ab2f, #a8e063);
    box-shadow: 0 8px 25px rgba(86,171,47,0.3);
}

.age-calculator-icon { 
    background: linear-gradient(135deg, #f857a6, #ff5858);
    box-shadow: 0 8px 25px rgba(248,87,166,0.3);
}

.percentage-calculator-icon { 
    background: linear-gradient(135deg, #ffc500, #f7971e);
    box-shadow: 0 8px 25px rgba(255,197,0,0.3);
}

.unit-converter-icon { 
    background: linear-gradient(135deg, #1c92d2, #f2fcfe);
    box-shadow: 0 8px 25px rgba(28,146,210,0.3);
}

.word-counter-icon { 
    background: linear-gradient(135deg, #757f9a, #d7dde8);
    box-shadow: 0 8px 25px rgba(117,127,154,0.3);
}

.random-selector-icon { 
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 0 8px 25px rgba(240,147,251,0.3);
}

.date-calculator-icon {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    box-shadow: 0 8px 25px rgba(67, 233, 123, 0.3);
}

.interest-calculator-icon {
    background: linear-gradient(135deg, #fde047, #f59e0b);
    box-shadow: 0 8px 25px rgba(253, 224, 71, 0.3);
}

.time-calculator-icon {
    background: linear-gradient(135deg, #38bdf8, #3b82f6);
    box-shadow: 0 8px 25px rgba(56, 189, 248, 0.3);
}

.case-converter-icon {
    background: linear-gradient(135deg, #c084fc, #9333ea);
    box-shadow: 0 8px 25px rgba(192, 132, 252, 0.3);
}

.compound-interest-icon {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.3);
}

.temperature-converter-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.data-storage-converter-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.pace-calculator-icon {
    background: linear-gradient(135deg, #f97316, #ea580c);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
}

.zakat-calculator-icon {
    background: linear-gradient(135deg, #facc15, #eab308);
    box-shadow: 0 8px 25px rgba(250, 204, 21, 0.3);
}

.final-grade-calculator-icon {
    background: linear-gradient(135deg, #ec4899, #d946ef);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.3);
}

.loan-calculator-icon {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.3);
}

.sales-tax-calculator-icon {
    background: linear-gradient(135deg, #84cc16, #65a30d);
    box-shadow: 0 8px 25px rgba(132, 204, 22, 0.3);
}

.tip-calculator-icon {
    background: linear-gradient(135deg, #d946ef, #a855f7);
    box-shadow: 0 8px 25px rgba(217, 70, 239, 0.3);
}

.calorie-calculator-icon {
    background: linear-gradient(135deg, #ef4444, #f87171);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.team-generator-icon {
    background: linear-gradient(135deg, #f59e0b, #facc15);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.ideal-weight-calculator-icon {
    background: linear-gradient(135deg, #10b981, #6ee7b7);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.fuel-cost-calculator-icon {
    background: linear-gradient(135deg, #f97316, #fb923c);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.3);
}

.body-fat-calculator-icon {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.number-system-converter-icon {
    background: linear-gradient(135deg, #1e293b, #475569);
    box-shadow: 0 8px 25px rgba(30, 41, 59, 0.3);
}

.aspect-ratio-calculator-icon {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.average-calculator-icon {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.3);
}

.text-reverse-tool-icon {
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    box-shadow: 0 8px 25px rgba(244, 63, 94, 0.3);
}

.password-generator-icon {
    background: linear-gradient(135deg, #4b5563, #9ca3af);
    box-shadow: 0 8px 25px rgba(75, 85, 99, 0.3);
}

.cooking-converter-icon {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 8px 25px rgba(217, 119, 6, 0.3);
}

.inflation-calculator-icon {
    background: linear-gradient(135deg, #0d9488, #2dd4bf);
    box-shadow: 0 8px 25px rgba(13, 148, 136, 0.3);
}

.time-zone-converter-icon {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    box-shadow: 0 8px 25px rgba(2, 132, 199, 0.3);
}

.color-code-converter-icon {
    background: linear-gradient(135deg, #be185d, #f472b6);
    box-shadow: 0 8px 25px rgba(190, 24, 93, 0.3);
}

.qr-code-generator-icon {
    background: linear-gradient(135deg, #4b5563, #1f2937);
    box-shadow: 0 8px 25px rgba(75, 85, 99, 0.3);
}

.roman-numeral-converter-icon {
    background: linear-gradient(135deg, #ca8a04, #f59e0b);
    box-shadow: 0 8px 25px rgba(202, 138, 4, 0.3);
}

.salary-calculator-icon {
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    box-shadow: 0 8px 25px rgba(29, 78, 216, 0.3);
}

.std-deviation-calculator-icon {
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    box-shadow: 0 8px 25px rgba(109, 40, 217, 0.3);
}

.url-encoder-decoder-icon {
    background: linear-gradient(135deg, #db2777, #f472b6);
    box-shadow: 0 8px 25px rgba(219, 39, 119, 0.3);
}

.text-to-binary-converter-icon {
    background: linear-gradient(135deg, #047857, #059669);
    box-shadow: 0 8px 25px rgba(4, 120, 87, 0.3);
}

.days-until-calculator-icon {
    background: linear-gradient(135deg, #ea580c, #f97316);
    box-shadow: 0 8px 25px rgba(234, 88, 12, 0.3);
}

.list-shuffler-icon {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

.fuel-efficiency-calculator-icon {
    background: linear-gradient(135deg, #15803d, #22c55e);
    box-shadow: 0 8px 25px rgba(21, 128, 61, 0.3);
}

.due-date-calculator-icon {
    background: linear-gradient(135deg, #f472b6, #fda4af);
    box-shadow: 0 8px 25px rgba(244, 114, 182, 0.3);
}

.morse-code-translator-icon {
    background: linear-gradient(135deg, #64748b, #94a3b8);
    box-shadow: 0 8px 25px rgba(100, 116, 139, 0.3);
}

.lorem-ipsum-generator-icon {
    background: linear-gradient(135deg, #78350f, #a16207);
    box-shadow: 0 8px 25px rgba(120, 53, 15, 0.3);
}

.pythagorean-calculator-icon {
    background: linear-gradient(135deg, #16a34a, #4ade80);
    box-shadow: 0 8px 25px rgba(22, 163, 74, 0.3);
}

.triangle-area-calculator-icon {
    background: linear-gradient(135deg, #c026d3, #d946ef);
    box-shadow: 0 8px 25px rgba(192, 38, 211, 0.3);
}

.circle-calculator-icon {
    background: linear-gradient(135deg, #9ca3af, #e5e7eb);
    box-shadow: 0 8px 25px rgba(156, 163, 175, 0.3);
}

.factorial-calculator-icon {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.3);
}

.prime-number-checker-icon {
    background: linear-gradient(135deg, #f59e0b, #fcd34d);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.leap-year-checker-icon {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.permutation-combination-icon {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    box-shadow: 0 8px 25px rgba(67, 56, 202, 0.3);
}

.wpm-calculator-icon {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    box-shadow: 0 8px 25px rgba(15, 118, 110, 0.3);
}

.scientific-notation-icon {
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.3);
}

.dilution-calculator-icon {
    background: linear-gradient(135deg, #0ea5e9, #67e8f9);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.3);
}

.ohms-law-calculator-icon {
    background: linear-gradient(135deg, #facc15, #fde047);
    box-shadow: 0 8px 25px rgba(250, 204, 21, 0.3);
}

.binary-to-text-converter-icon {
    background: linear-gradient(135deg, #166534, #15803d);
    box-shadow: 0 8px 25px rgba(22, 101, 52, 0.3);
}

.percentage-change-calculator-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.savings-calculator-icon {
    background: linear-gradient(135deg, #f59e0b, #facc15);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.speed-distance-time-calculator-icon {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.energy-consumption-calculator-icon {
    background: linear-gradient(135deg, #facc15, #fde047);
    box-shadow: 0 8px 25px rgba(250, 204, 21, 0.3);
}

.volume-calculator-icon {
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.3);
}

.probability-calculator-icon {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.breakeven-point-calculator-icon {
    background: linear-gradient(135deg, #ec4899, #f472b6);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.3);
}

.commission-calculator-icon {
    background: linear-gradient(135deg, #16a34a, #4ade80);
    box-shadow: 0 8px 25px rgba(22, 163, 74, 0.3);
}

.character-count-tool-icon {
    background: linear-gradient(135deg, #64748b, #94a3b8);
    box-shadow: 0 8px 25px rgba(100, 116, 139, 0.3);
}

.coin-flip-simulator-icon {
    background: linear-gradient(135deg, #eab308, #fde047);
    box-shadow: 0 8px 25px rgba(234, 179, 8, 0.3);
}

.dice-roll-simulator-icon {
    background: linear-gradient(135deg, #ef4444, #f87171);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.vat-calculator-icon {
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

.grade-calculator-icon {
    background: linear-gradient(135deg, #f6d365, #fda085);
    box-shadow: 0 8px 25px rgba(246, 211, 101, 0.3);
}

.bmi-calculator-icon {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.3);
}

.discount-calculator-icon {
    background: linear-gradient(135deg, #ff8c42, #ff3c5f);
    box-shadow: 0 8px 25px rgba(255, 140, 66, 0.3);
}

.random-number-generator-icon {
    background: linear-gradient(135deg, #89f7fe, #66a6ff);
    box-shadow: 0 8px 25px rgba(137, 247, 254, 0.3);
}

.app-title {
    font-size: 1.3rem; /* Reduced for more space */
    font-weight: 700;
    margin-bottom: 12px;
    color: #ffffff;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.app-card:hover .app-title {
    transform: translateY(-3px);
    text-shadow: 0 3px 15px rgba(99, 102, 241, 0.5);
}

.app-description {
    font-size: 0.9rem; /* Reduced for more space */
    color: #c7d2fe;
    font-weight: 400;
    line-height: 1.5; /* Reduced line height */
    letter-spacing: -0.2px;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.app-card:hover .app-description {
    color: #e0e7ff;
    opacity: 1;
}

.footer {
    margin-top: 80px;
    padding: 50px 40px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    border-radius: 35px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.9);
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dedication {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 18px;
    line-height: 1.8;
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
    background: linear-gradient(135deg, #fff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prayer {
    font-size: 1.15rem;
    font-weight: 400;
    margin-bottom: 35px;
    opacity: 0.9;
    font-style: italic;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    color: #e0e7ff;
}

.author-info {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.author {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
}

.whatsapp-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #25D366;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.15rem;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: rgba(37, 211, 102, 0.08);
    padding: 15px 25px;
    border-radius: 18px;
    border: 1px solid rgba(37, 211, 102, 0.25);
    box-shadow: 0 5px 20px rgba(37, 211, 102, 0.1);
}

.whatsapp-link:hover {
    background: rgba(37, 211, 102, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.3);
    border-color: rgba(37, 211, 102, 0.4);
}

.whatsapp-icon {
    font-size: 1.2rem;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0c29 0%, #24243e 50%, #313862 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-screen p {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-container {
    position: relative;
    max-width: 650px;
    margin: 35px auto 0;
}

.search-input {
    width: 100%;
    padding: 20px 60px 20px 30px;
    font-size: 1.15rem;
    font-family: 'Almarai', sans-serif;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    color: white;
    outline: none;
    transition: all 0.4s ease;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

.search-icon {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    pointer-events: none;
    opacity: 0.7;
}

.filter-container {
    display: flex;
    flex-direction: column; /* Vertical stacking */
    gap: 10px;
    margin-top: 10px;
    padding-bottom: 20px; /* Added separation space */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.calculator-filter-container {
    display: flex;
    flex-direction: column; /* Vertical stacking */
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    /* Styles moved to end of file for clarity and override logic */
    background: transparent; 
    border-radius: 20px;
}



/* New Announcement Bar Styles */
.announcement-bar {
    margin-top: 40px;
    padding: 15px 30px;
    background: linear-gradient(90deg, #1f2937, #374151, #1f2937);
    border-radius: 18px;
    border: 2px solid #6366f1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
    font-size: 1.1rem;
    font-weight: 500;
    overflow: hidden;
    position: relative;
    text-align: center;
}

.announcement-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -200%;
    width: 400%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
    animation: shine 4s infinite linear;
}

@keyframes shine {
    0% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.announcement-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.announcement-text {
    flex-grow: 1;
    line-height: 1.5;
}

.announcement-text strong {
    color: #ffc500;
    font-weight: 700;
}

/* Tablet/Mobile Layout Adjustments for Vertical Tabs */
@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
        gap: 30px;
    }
    
    .sidebar {
        width: 280px;
        position: fixed;
        top: 0;
        bottom: 0;
        right: 0;
        left: auto;
        z-index: 1001;
        max-height: none;
        padding: 30px 20px;
        margin-bottom: 0;
        visibility: visible;
        opacity: 1;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        border-radius: 20px 0 0 20px;
        border: none;
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
        max-height: none;
        padding: 30px 20px;
    }
    
    .header {
        position: relative; /* Needed for menu button positioning */
    }

    /* Show the toggle button */
    .menu-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 25px;
        right: 25px;
        z-index: 1002;
        width: 60px;
        height: 60px;
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-radius: 18px;
        color: white;
        font-size: 2rem;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        box-shadow: 
            0 10px 30px rgba(99, 102, 241, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(20px);
        padding: 0;
    }
    
    .menu-toggle-btn:hover {
        transform: translateY(-3px) scale(1.08);
        background: linear-gradient(135deg, #8b5cf6, #d946ef);
        box-shadow: 
            0 15px 40px rgba(99, 102, 241, 0.6),
            0 0 25px rgba(217, 70, 239, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
        border-color: rgba(255, 255, 255, 0.4);
    }
    
    .menu-toggle-btn:active {
        transform: translateY(-1px) scale(1.04);
    }
    
    .filter-container, .calculator-filter-container {
        flex-direction: column; /* Force vertical stacking for mobile tabs */
        justify-content: flex-start; /* Align filters to start */
        flex-wrap: nowrap;
        gap: 10px;
        margin-top: 15px;
    }
    
    .filter-btn, .calc-filter-btn {
        width: 100%; /* Make them full width again */
        flex-grow: 0;
        text-align: right; /* Maintain RTL alignment */
        max-width: none;
        padding: 14px 20px;
        font-size: 1.05rem;
    }
    
    .filter-btn {
        padding: 14px 20px;
    }

    .apps-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* Use the new smaller card size */
    }
    
    .videos-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Specific Mobile Optimizations */
@media (max-width: 768px) {
    .calculator-modal-container {
        padding: 0;
    }

    .calculator-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        padding: 20px;
        overflow-y: auto;
        align-self: flex-start; 
        box-shadow: none;
    }
    
    .calculator-modal-close-btn {
        top: 20px;
        left: 20px;
        right: auto;
        background: rgba(255,255,255,0.2);
    }
    
    .calc-row {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .calc-row > div {
        flex: none;
        width: 100%;
    }

    .calc-buttons-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .video-modal-content {
        max-width: 95%;
        padding: 15px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        padding: 25px 15px;
        margin-bottom: 20px;
        border-radius: 25px;
    }
    
    .title {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .stats-container {
        gap: 10px;
        margin: 20px 0 20px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-number {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .search-input {
        padding: 15px 50px 15px 20px;
        font-size: 1rem;
        border-radius: 20px;
    }
    
    .search-icon {
        left: 15px;
        font-size: 1.3rem;
    }
    
    .announcement-bar {
        font-size: 0.9rem;
        padding: 12px 20px;
        margin-top: 25px;
        flex-direction: column;
        gap: 8px;
    }
    .announcement-icon {
        display: none;
    }



    .apps-grid, .videos-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .app-card {
        padding: 25px 20px;
    }
    
    .app-icon {
        width: 75px;
        height: 75px;
        font-size: 2.8rem;
        margin-bottom: 15px;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
    
    .app-description {
        font-size: 0.9rem;
    }
    
    .video-card {
        /* Padding removed globally above, ensuring structure works */
    }
    .video-thumbnail {
        border-radius: 20px 20px 0 0;
        margin-bottom: 0;
    }
    .video-info {
        padding: 15px 20px 20px;
    }
    .video-title {
        font-size: 1.2rem;
    }
    .video-description {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .video-title,
    .video-description {
        /* CLEANUP: Removing redundant styles now handled by standard flow */
    }
    
    .video-meta {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .footer {
        padding: 30px 15px;
        margin-top: 40px;
        border-radius: 25px;
    }
    
    .dedication {
        font-size: 1.1rem;
    }

    .prayer {
        font-size: 0.9rem;
    }

    .author-info {
        padding: 15px;
    }

    .whatsapp-link {
        font-size: 1rem;
        padding: 10px 15px;
    }
}
/* End Announcement Bar Styles */

/* --- Sidebar & Filter Button Styling --- */

/* Base filter button style (Main categories) */
.filter-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-family: 'Almarai', sans-serif;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05); /* Lighter glass base */
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    color: #c7d2fe;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    text-align: right;
    position: relative;
    overflow: hidden;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 8px rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-3px);
    color: white;
    font-weight: 700;
}

/* Specific highlight for Latest (آخر الإضافات) */
.filter-btn.latest-btn {
    font-weight: 800;
    color: #fff;
    background: linear-gradient(90deg, #f97316 0%, #ec4899 100%);
    border: 2px solid #fff363;
    animation: pulseGlow 1.5s infinite alternate;
    box-shadow: 0 5px 20px rgba(249, 115, 22, 0.5);
}

.filter-btn.latest-btn:hover {
    transform: scale(1.01);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.8);
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 10px rgba(255, 197, 0, 0.4), 0 5px 20px rgba(249, 115, 22, 0.5); }
    100% { box-shadow: 0 0 20px rgba(255, 197, 0, 0.7), 0 5px 25px rgba(249, 115, 22, 0.8); }
}

/* Calculator Sub-Filter refinement */
.calculator-filter-container {
    background: rgba(255, 255, 255, 0.03); /* Apply detailed background here */
    border: 1px dashed rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.calc-filter-btn {
    width: 100%;
    text-align: right;
    padding: 8px 15px;
    font-size: 0.9rem;
    font-family: 'Almarai', sans-serif;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #b3b3e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-filter-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(-3px);
    color: white;
}

.calc-filter-btn.active {
    background: #4f46e5;
    border-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.5);
    transform: none;
    color: white;
    font-weight: 600;
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: white;
}

/* --- Calculator Modal Styles --- */
.calculator-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Dark overlay */
    backdrop-filter: blur(15px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.calculator-modal-container.visible {
    visibility: visible;
    opacity: 1;
}

.calculator-modal-content {
    background: #1f2937; /* Dark background for content */
    border-radius: 25px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
    overflow-y: auto; /* For long calculators */
    max-height: 90vh; /* Max height on desktop */
}

.calculator-modal-container.visible .calculator-modal-content {
    transform: scale(1);
}

.calculator-modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 40px;
    text-align: center;
    transition: background 0.2s;
    z-index: 10;
}

.calculator-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

#calculator-title {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #a855f7;
    text-align: center;
    font-weight: 700;
}

/* Calculator Inputs/Buttons */
.calc-label {
    display: block;
    margin-bottom: 8px;
    margin-top: 15px;
    font-size: 1rem;
    color: #c7d2fe;
    font-weight: 500;
}

.calc-input, .calc-select, .calc-textarea {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    font-family: 'Almarai', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    outline: none;
    transition: border-color 0.3s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
    direction: rtl; /* Ensure RTL for Arabic text input */
    text-align: right;
}

.calc-input[type="number"], .calc-input[type="date"], #password-output, #tz-local-time, #tz-converted-time {
    direction: ltr; /* Ensure numbers/dates input correctly left-to-right */
    text-align: left;
}


.calc-textarea {
    resize: vertical;
    min-height: 100px;
    padding: 15px;
}

.calc-input:focus, .calc-select:focus, .calc-textarea:focus {
    border-color: #6366f1;
    background: rgba(0, 0, 0, 0.4);
}

.calc-button {
    width: 100%;
    padding: 14px 20px;
    margin-top: 20px;
    font-size: 1.1rem;
    font-family: 'Almarai', sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.calc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.calc-row {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    align-items: flex-end;
}
.calc-row > div {
    flex: 1;
}

.calc-buttons-row {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.calc-result {
    margin-top: 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #38bdf8;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
}

.calc-sub-result {
    margin-top: 10px;
    font-size: 1rem;
    color: #a8a29e;
    text-align: center;
}

/* Specific calculator styles */
#qrcode {
    margin: 20px auto;
    width: 128px;
    height: 128px;
}
#color-picker-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}
#color-picker {
    width: 60px;
    height: 60px;
    border: none;
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
    background: transparent;
}
.calc-checkbox-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
    color: #c7d2fe;
    cursor: pointer;
    font-size: 0.95rem;
}

.calc-checkbox-container input {
    margin-left: 10px;
    width: 20px;
    height: 20px;
}
/* Coin/Dice Simulators */
#coin-flip-result div, #dice-roll-result div {
    font-size: 3rem;
    animation: bounce 0.5s ease-out;
}
@keyframes bounce {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

.no