/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Tajawal:wght@300;400;500;600;700;800;900&family=Amiri:wght@400;700&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #B721FF 0%, #21D4FD 100%);
    --secondary-gradient: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
    --gold-gradient: linear-gradient(135deg, #FFD700 0%, #DAA520 100%);
    --success-gradient: linear-gradient(135deg, #00C853 0%, #64DD17 100%);
    --warm-gradient: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 100%);
    --ocean-gradient: linear-gradient(135deg, #00B4DB 0%, #0083B0 100%);
    --sunset-gradient: linear-gradient(135deg, #FF416C 0%, #FF4B2B 100%);
    
    --text-dark: #2c3e50;
    --text-light: #34495e;
    --text-muted: #7f8c8d;
    --white: #ffffff;
    --light-bg: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow-light: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 16px 48px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 24px 64px rgba(0, 0, 0, 0.2);
    
    --border-radius: 24px;
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    --font-primary: 'Cairo', sans-serif;
    --font-secondary: 'Tajawal', sans-serif;
    --font-decorative: 'Amiri', serif;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== SPLASH SCREEN ===== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: var(--transition);
}

.splash-content {
    text-align: center;
    color: var(--white);
    animation: fadeInUp 1s ease-out;
}

.splash-title {
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 2rem;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
    to { text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 40px rgba(255, 255, 255, 0.6); }
}

.typewriter-container {
    position: relative;
    display: inline-block;
}

.typewriter-text {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    min-height: 3rem;
    font-weight: 500;
}

.cursor {
    display: inline-block;
    animation: blink 1s infinite;
    font-size: 1.5em;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.floating-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-stars span {
    position: absolute;
    font-size: 2rem;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    opacity: 0;
    transform: translateY(50px);
    transition: var(--transition);
}

.main-content.hidden {
    display: none;
}

.main-content.show {
    opacity: 1;
    transform: translateY(0);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== HEADER ===== */
.header {
    padding: 4rem 0 2rem;
    text-align: center;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 0 0 50% 50%;
}

.main-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    color: var(--white);
    margin-bottom: 1rem;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    animation: slideInDown 1s ease-out;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: slideInUp 1s ease-out 0.3s both;
    position: relative;
    z-index: 1;
}

/* ===== FLOATING BACKGROUND WORDS ===== */
.floating-words {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.floating-words span {
    position: absolute;
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.05);
    animation: floatWords 20s linear infinite;
}

.floating-words span:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.floating-words span:nth-child(2) { top: 20%; right: 15%; animation-delay: 3s; }
.floating-words span:nth-child(3) { top: 40%; left: 20%; animation-delay: 6s; }
.floating-words span:nth-child(4) { top: 60%; right: 25%; animation-delay: 9s; }
.floating-words span:nth-child(5) { top: 80%; left: 30%; animation-delay: 12s; }
.floating-words span:nth-child(6) { top: 70%; right: 10%; animation-delay: 15s; }

@keyframes floatWords {
    0% { transform: translateY(0px) rotate(0deg); opacity: 0.05; }
    50% { transform: translateY(-30px) rotate(180deg); opacity: 0.1; }
    100% { transform: translateY(0px) rotate(360deg); opacity: 0.05; }
}

/* ===== SECTIONS ===== */
.teachers-section,
.admin-section,
.students-section {
    padding: 4rem 0;
    position: relative;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--white);
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--warm-gradient);
    border-radius: 2px;
}

/* ===== CARDS GRID ===== */
.teachers-grid,
.admin-grid,
.students-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Mobile: 2 cards per row */
@media (max-width: 768px) {
    .teachers-grid,
    .admin-grid,
    .students-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .teachers-grid,
    .admin-grid,
    .students-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
}

/* ===== CARD STYLES ===== */
.teacher-card,
.admin-card,
.student-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(50px);
    animation: fadeInUp 0.8s ease-out forwards;
}

.teacher-card:nth-child(1) { animation-delay: 0.1s; }
.teacher-card:nth-child(2) { animation-delay: 0.2s; }
.teacher-card:nth-child(3) { animation-delay: 0.3s; }
.teacher-card:nth-child(4) { animation-delay: 0.4s; }
.teacher-card:nth-child(5) { animation-delay: 0.5s; }
.teacher-card:nth-child(6) { animation-delay: 0.6s; }
.teacher-card:nth-child(7) { animation-delay: 0.7s; }

.teacher-card::before,
.admin-card::before,
.student-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.8s ease;
}

.teacher-card:hover::before,
.admin-card:hover::before,
.student-card:hover::before {
    left: 100%;
}

.teacher-card:hover,
.admin-card:hover,
.student-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-heavy);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ===== CARD ICONS ===== */
.teacher-icon,
.admin-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
}

.teacher-card:hover .teacher-icon,
.admin-card:hover .admin-icon {
    transform: scale(1.1) rotate(360deg);
    box-shadow: var(--shadow-heavy);
}

.student-avatar {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* ===== CARD TEXT ===== */
.teacher-name,
.admin-name,
.student-name {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.teacher-subject,
.admin-description {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* ===== BUTTONS ===== */
.read-message-btn,
.student-note-btn,
.add-message-btn {
    background: var(--warm-gradient);
    color: var(--white);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
}

.read-message-btn:hover,
.student-note-btn:hover,
.add-message-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.read-message-btn.pulse,
.student-note-btn.pulse,
.add-message-btn.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* ===== ADD MESSAGE SECTION ===== */
.add-message-container {
    text-align: center;
    margin: 3rem 0;
}

.add-message-btn {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    padding: 1rem 2rem;
    background: var(--success-gradient);
}

.custom-messages {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.custom-message-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideInUp 0.6s ease-out;
}

.custom-message-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.custom-message-text {
    color: var(--text-light);
    line-height: 1.6;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--white);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-heavy);
    animation: slideInUp 0.4s ease-out;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 1001;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-dark);
    transform: scale(1.1);
}

.message-paper,
.student-note-paper,
.add-message-form {
    background: var(--sunset-gradient);
    padding: 2rem;
    margin: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
}

.modal-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 2rem;
    font-family: var(--font-decorative);
}

.modal-message,
.student-note-message {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    line-height: 1.8;
    color: var(--text-dark);
    white-space: pre-line;
    text-align: right;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.action-btn {
    background: var(--ocean-gradient);
    color: var(--white);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.submit-btn {
    background: var(--success-gradient);
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    width: 100%;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* ===== FOOTER ===== */
.footer {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    padding: 3rem 0;
    text-align: center;
    margin-top: 4rem;
}

.footer p {
    color: var(--white);
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    font-weight: 600;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== CONFETTI ===== */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 1000;
    pointer-events: none;
    animation: confettiFall 4s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .header {
        padding: 2rem 0 1rem;
    }
    
    .teachers-section,
    .admin-section,
    .students-section {
        padding: 2rem 0;
    }
    
    .teacher-card,
    .admin-card,
    .student-card {
        padding: 1.5rem;
    }
    
    .teacher-icon,
    .admin-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .message-paper,
    .student-note-paper,
    .add-message-form {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .teacher-card,
    .admin-card,
    .student-card {
        padding: 1rem;
    }
    
    .teacher-icon,
    .admin-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .read-message-btn,
    .student-note-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .modal,
    .floating-words,
    .confetti,
    .add-message-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .message-paper {
        background: white !important;
        box-shadow: none !important;
    }
}