@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&display=swap');

:root {
    --primary-color: #4a148c; /* Royal Purple */
    --primary-light: #7b1fa2;
    --secondary-color: #ffc107; /* Gold */
    --accent-color: #ff9800; /* Vibrant Orange */
    --bg-grad-1: #4a148c;
    --bg-grad-2: #0d47a1;
    --text-color: #333;
    --bg-color: #f3e5f5;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --radius: 15px;
}

/* Themes */
body.theme-academic {
    --bg-grad-1: #4a148c;
    --bg-grad-2: #0d47a1;
    --primary-color: #4a148c;
    --primary-light: #7b1fa2;
}

body.theme-discipline {
    --bg-grad-1: #004d40;
    --bg-grad-2: #00796b;
    --primary-color: #004d40;
    --primary-light: #00695c;
    --secondary-color: #ffe082;
}

body.theme-behavior {
    --bg-grad-1: #b71c1c;
    --bg-grad-2: #d84315;
    --primary-color: #b71c1c;
    --primary-light: #c62828;
    --secondary-color: #ffe082;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Almarai', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
    background-attachment: fixed;
    transition: background 0.5s ease-in-out;
    color: var(--text-color);
    min-height: 100vh;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Category Tabs */
.tabs-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
}

.tab-btn.active {
    background: var(--secondary-color);
    color: var(--primary-color);
    border-color: var(--secondary-color);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Glassmorphism Card with 3D depth */
.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* 3D raised effect */
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);
    padding: 30px;
    margin-bottom: 30px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 15px 12px rgba(0, 0, 0, 0.1);
}

/* School Header */
.school-header {
    text-align: center;
    color: white;
    padding: 60px 0;
    text-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.school-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-logo {
    max-height: 120px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2));
    transition: 0.3s;
}

.header-logo:hover {
    transform: scale(1.05);
}

.header-center {
    flex: 2;
}

.school-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--secondary-color);
    letter-spacing: 1px;
}

.school-meta {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 1rem;
}

.school-meta span {
    background: rgba(255,255,255,0.15);
    padding: 8px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Manager Section - High End 3D Frame */
.manager-section {
    position: relative;
    padding: 15px 50px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    border: 8px solid white;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.3),
        inset 0 0 20px rgba(74, 20, 140, 0.1);
    border-radius: 20px;
}

.manager-section::after {
    content: '';
    position: absolute;
    inset: 5px;
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    pointer-events: none;
    opacity: 0.5;
}

.manager-word {
    font-size: 1.5rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 5px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* Student & Class Cards 3D tweak */
.class-card, .student-card {
    border-bottom: 5px solid var(--secondary-color);
}

.student-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    margin: 0 auto 15px;
    border: 6px solid white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    object-fit: cover;
    background: #fff;
    transition: 0.4s;
}

.student-card:hover .student-avatar {
    transform: rotate(5deg) scale(1.1);
}

.manager-signature {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.signature-img {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.1));
}

/* Class Cards Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

.class-card {
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.class-card h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.class-card .count {
    font-size: 1rem;
    color: #666;
}

/* Student Profile Cards */
.student-card {
    text-align: center;
    padding: 20px;
}

.student-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 15px;
    border: 5px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    object-fit: cover;
    background: #fff;
}

.student-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.student-score {
    background: var(--secondary-color);
    color: #000;
    display: inline-block;
    padding: 3px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.student-rank {
    margin-top: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
    display: table;
    margin-left: auto;
    margin-right: auto;
    padding: 5px 20px;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    background: rgba(74, 20, 140, 0.05); /* خفيف من البنفسجي */
    box-shadow: 0 0 10px rgba(74, 20, 140, 0.2);
    animation: pulse-purple 2s infinite;
}

@keyframes pulse-purple {
    0% { box-shadow: 0 0 0 0 rgba(74, 20, 140, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(74, 20, 140, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 20, 140, 0); }
}

/* Buttons */
.btn {
    padding: 10px 25px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
}

/* Admin Styles (simplified) */
.admin-sidebar {
    background: var(--primary-color);
    color: white;
    min-width: 250px;
    height: 100vh;
    padding: 20px;
}

canvas#sig-canvas {
    border: 2px dashed #ccc;
    border-radius: 5px;
    cursor: crosshair;
    background: #fff;
    width: 100%;
    max-width: 500px;
    height: 200px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade {
    animation: fadeIn 0.8s ease forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .school-header .container {
        padding: 40px 20px;
    }
    
    .header-logo {
        max-height: 80px; 
    }

    .school-header h1 { 
        font-size: 2.2rem; 
        margin-bottom: 5px;
    }

    .school-header h2 {
        font-size: 1.2rem !important;
    }

    .school-meta {
        gap: 10px;
        font-size: 0.85rem;
    }

    .school-meta span {
        padding: 5px 15px;
    }

    .manager-section { padding: 10px 25px; }
    .manager-word { font-size: 1.1rem; line-height: 1.5; margin-bottom: 5px; }
}

@media (max-width: 480px) {
    .school-header h1 { font-size: 1.8rem; }
    .header-logo { max-height: 60px; }
}
