/* ============================================
   Дневник Преподавателя — Dark Theme CSS
   ============================================ */

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

:root {
    --primary:       #20c997;
    --primary-dark:  #17a882;
    --secondary:     #2ecc71;
    --success:       #2ecc71;
    --danger:        #ef4444;
    --warning:       #f59e0b;
    --info:          #06b6d4;
    --bg:            #181818;
    --card-bg:       rgba(255,255,255,0.04);
    --border:        rgba(255,255,255,0.1);
    --text:          #e0e0e0;
    --text-muted:    #a0a0a0;
    --shadow:        0 4px 20px rgba(0,0,0,0.4);
    --shadow-lg:     0 12px 40px rgba(0,0,0,0.6);
    --radius:        16px;
    --radius-sm:     10px;
    --transition:    .2s ease;
    --font:          'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
}

html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: #fff; }
h1,h2,h3,h4,h5,h6 { color: #fff; font-weight: 700; line-height: 1.3; }
img { max-width: 100%; }

/* ----- Navbar ----- */
.navbar {
    background: #1e1e1e;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.navbar-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; height: 62px; }
.navbar-brand { display: flex; align-items: center; gap: .6rem; color: #fff !important; font-size: 1.2rem; font-weight: 800; flex-shrink: 0; }
.navbar-logo { height: 36px !important; width: auto !important; filter: brightness(1.2); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text small { font-weight: 400; opacity: .6; font-size: .7rem; margin-top: 2px; }
.navbar-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; }
.navbar-menu { display: flex; align-items: center; gap: .5rem; }
.navbar-nav { display: flex; align-items: center; gap: .1rem; flex: 1; justify-content: center; padding: 0 1rem; }
.nav-link { color: rgba(255,255,255,.65) !important; padding: .45rem .7rem; border-radius: 8px; font-size: .83rem; font-weight: 500; transition: all var(--transition); white-space: nowrap; }
.nav-link:hover, .nav-link.active { background: rgba(32,201,151,.2); color: #fff !important; }
.nav-link i { margin-right: .3rem; }
.navbar-user { display: flex; align-items: center; gap: .6rem; margin-left: 1rem; flex-shrink: 0; padding-left: 1rem; border-left: 1px solid var(--border); }
.user-avatar-sm { width: 34px; height: 34px; min-width: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: .85rem; font-weight: 600; color: #fff; }
.user-role { font-size: .7rem; color: var(--text-muted); }
.btn-logout { color: var(--text-muted) !important; padding: .4rem; border-radius: 50%; transition: all var(--transition); }
.btn-logout:hover { color: var(--danger) !important; background: rgba(231,76,60,.15); }

/* ----- Main ----- */
.main-content { max-width: 1280px; margin: 0 auto; padding: 1.5rem; min-height: calc(100vh - 62px - 48px); }
.main-guest { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #181818; }

/* ----- Footer ----- */
.footer { background: rgba(0,0,0,.3); border-top: 1px solid var(--border); color: var(--text-muted); padding: .8rem 1.5rem; font-size: .8rem; }
.footer-inner { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.footer-left { display: flex; align-items: center; gap: .5rem; }
.footer-logo { height: 20px; width: auto; display: inline-block; vertical-align: middle; }

/* ----- Flash ----- */
.flash { position: fixed; top: 72px; right: 1.5rem; padding: .8rem 1.2rem; border-radius: var(--radius-sm); color: #fff; font-size: .9rem; display: flex; align-items: center; gap: .6rem; z-index: 9999; animation: slideIn .3s ease; max-width: 400px; box-shadow: var(--shadow-lg); }
.flash-success { background: var(--success); }
.flash-error   { background: var(--danger); }
.flash-info    { background: var(--info); }
.flash-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; margin-left: auto; }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ----- Cards ----- */
.card { background: #242424; backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color var(--transition); }
.card:hover { border-color: rgba(32,201,151,.25); }
.card-header { background: #1e1e1e; border-bottom: 1px solid var(--border); color: #fff; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.card-header h2, .card-header h3 { color: #fff; margin: 0; font-size: 1rem; }
.card-header i { margin-right: .5rem; }
.card-body { padding: 1.5rem; }
.card-body-np { padding: 0; }

/* ----- Stats ----- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.5rem; display: flex; align-items: center; gap: 1rem; transition: transform var(--transition); }
.stat-card:hover { transform: translateY(-2px); border-color: rgba(32,201,151,.3); }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; background: transparent; }
.stat-icon.blue   { color: #06b6d4; }
.stat-icon.green  { color: #2ecc71; }
.stat-icon.orange { color: #f59e0b; }
.stat-icon.purple { color: #20c997; }
.stat-icon.red    { color: #ef4444; }
.stat-info { flex: 1; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: #fff; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ----- Tables ----- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table thead th { background: rgba(32,201,151,.15); color: rgba(255,255,255,.8); padding: .7rem 1rem; text-align: left; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--border); }
table tbody td { padding: .6rem 1rem; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; color: var(--text); }
table tbody tr:hover { background: rgba(255,255,255,.03); }
table tbody tr:last-child td { border-bottom: none; }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.2rem; border: none; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600; cursor: pointer; transition: all var(--transition); white-space: nowrap; font-family: var(--font); }
.btn:active { transform: scale(.97); }
.btn-primary  { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-outline  { background: transparent; color: rgba(255,255,255,.7); border: 1px solid var(--border); }
.btn-outline:hover { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; }

/* ----- Forms ----- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .35rem; color: rgba(255,255,255,.75); }
.form-control { width: 100%; padding: .6rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; font-family: var(--font); transition: border-color var(--transition), box-shadow var(--transition); background: rgba(255,255,255,.07); color: #fff; }
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(32,201,151,.2); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23aaa'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; background-color: rgba(255,255,255,.07); }
select.form-control option { background: #1e1e1e; color: #fff; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ----- Login ----- */
.login-container { width: 100%; max-width: 440px; padding: 1.5rem; }
.login-card { background: rgba(255,255,255,.05); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg); }
.login-header { background: linear-gradient(135deg, rgba(32,201,151,.35), rgba(34,197,94,.35)); color: #fff; padding: 2rem 2rem 1.5rem; text-align: center; }
.login-logo { height: 80px !important; width: auto !important; display: block; margin: 0 auto 1.2rem; }
.login-header h1 { color: #fff; font-size: 1.4rem; margin-bottom: .2rem; }
.login-header p { color: rgba(255,255,255,.6); font-size: .85rem; }
.login-body { padding: 2rem; }
.login-body .form-group { margin-bottom: 1.2rem; }
.login-body .btn { width: 100%; justify-content: center; padding: .7rem; font-size: 1rem; }
.login-footer { text-align: center; padding: 1rem 2rem 1.5rem; color: var(--text-muted); font-size: .82rem; }
.login-footer a { color: var(--primary); }

/* ----- Grade badge ----- */
.grade-badge { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; font-weight: 700; font-size: .85rem; color: #fff; }

/* ----- Announcements ----- */
.announcement-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem 1.5rem; border-left: 4px solid var(--primary); transition: all var(--transition); }
.announcement-card:hover { border-color: rgba(32,201,151,.4); }
.announcement-card.pinned { border-left-color: var(--warning); }
.announcement-title { font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: .4rem; }
.announcement-meta { font-size: .8rem; color: var(--text-muted); margin-bottom: .6rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.announcement-content { font-size: .9rem; line-height: 1.7; color: var(--text); }

/* ----- Welcome banner ----- */
.welcome-banner { background: linear-gradient(135deg, #1e1e1e 0%, #134e4a 60%, #064e3b 100%); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.8rem 2rem; color: #fff; margin-bottom: 1.5rem; position: relative; overflow: hidden; }
.welcome-banner::after { content: ''; position: absolute; right: -30px; top: -30px; width: 160px; height: 160px; background: rgba(32,201,151,.1); border-radius: 50%; pointer-events: none; }
.welcome-banner h1 { color: #fff; font-size: 1.5rem; margin-bottom: .3rem; }
.welcome-banner p { color: rgba(255,255,255,.6); font-size: .9rem; }
.welcome-banner .welcome-date { font-size: .83rem; color: rgba(255,255,255,.4); margin-top: .4rem; display: flex; align-items: center; gap: .3rem; }

/* ----- Page header ----- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { margin: 0; font-size: 1.5rem; }

/* ----- Modal ----- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 5000; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; }
.modal-box { background: #242424; border: 1px solid rgba(32,201,151,.3); border-radius: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,.8); animation: modalIn .2s ease; padding: 1.5rem; }
.modal-lg { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.modal-header h3 { margin: 0; color: #fff; font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); padding: .2rem; line-height: 1; transition: color var(--transition); }
.modal-close:hover { color: var(--danger); }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
@keyframes modalIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ----- Empty state ----- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; color: rgba(255,255,255,.1); margin-bottom: 1rem; display: block; }
.empty-state p { margin-bottom: 1rem; }

/* ----- Pagination ----- */
.pagination { display: flex; gap: .3rem; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span { padding: .4rem .8rem; border-radius: 8px; font-size: .85rem; font-weight: 600; display: inline-block; }
.pagination a { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); }
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border: 1px solid var(--primary); }

/* ----- Att badge ----- */
.att-badge { display: inline-block; padding: .15rem .6rem; border-radius: 10px; font-size: .78rem; font-weight: 600; color: #fff; }

/* ----- Progress ----- */
.progress-bar { height: 6px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }

/* ----- Nav arrows ----- */
.nav-arrow { display: inline-flex; align-items: center; justify-content: center; color: rgba(255,255,255,.7) !important; transition: all var(--transition); padding: .3rem .5rem; border-radius: 8px; border: 1px solid var(--border); }
.nav-arrow:hover { background: rgba(255,255,255,.08); color: #fff !important; }

/* ----- Utility ----- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; } .gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.align-center { align-items: center; } .flex-wrap { flex-wrap: wrap; }

/* ----- Responsive ----- */
@media (max-width: 900px) {
    .navbar-toggle { display: block; }
    .navbar-menu { display: none; position: absolute; top: 62px; left: 0; right: 0; background: #1a1a1a; flex-direction: column; padding: 1rem; gap: .3rem; box-shadow: var(--shadow-lg); border-bottom: 1px solid var(--border); }
    .navbar-menu.open { display: flex; animation: slideDown .25s ease; }
    .navbar-nav { flex-direction: column; width: 100%; align-items: flex-end; }
    .nav-link { padding: .7rem 1rem; display: block; }
    .navbar-user { border-left: none; margin-left: 0; padding-left: 0; padding-top: .8rem; border-top: 1px solid var(--border); width: 100%; display: flex; justify-content: flex-end; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 600px) {
    .main-content { padding: 1rem; }
    .welcome-banner { padding: 1.2rem; }
    .welcome-banner h1 { font-size: 1.2rem; }
    .card-body { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .modal-box { padding: 1.2rem; }
}

/* ===== ANIMATIONS ===== */

/* Page load fade-in */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(.95); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(32,201,151,.2); }
    50%      { box-shadow: 0 0 20px rgba(32,201,151,.4); }
}
@keyframes bounceIn {
    0%   { transform: scale(.3); opacity: 0; }
    50%  { transform: scale(1.05); }
    70%  { transform: scale(.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Staggered entrance for cards */
.card, .stat-card, .announcement-card, .group-card {
    animation: fadeInUp .4s ease both;
}
.stats-grid .stat-card:nth-child(1) { animation-delay: .05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: .1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: .15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: .2s; }

/* Hover glow on cards */
.card { transition: border-color .25s, box-shadow .25s, transform .25s; }
.card:hover { box-shadow: 0 4px 24px rgba(32,201,151,.1); }

/* Stat card hover */
.stat-card { transition: transform .25s, border-color .25s, box-shadow .25s; }
.stat-card:hover { box-shadow: 0 6px 20px rgba(32,201,151,.12); }
.stat-card:hover .stat-icon i { animation: bounceIn .4s ease; }

/* Button hover & click */
.btn { transition: all .2s ease; position: relative; overflow: hidden; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.btn:active { transform: scale(.96) translateY(0); }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(32,201,151,.3); }

/* Ripple effect */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,.3), transparent 60%);
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}
.btn.ripple::after { opacity: 1; transition: opacity 0s; }

/* Nav link hover */
.nav-link { transition: all .2s ease; position: relative; }
.nav-link:hover { transform: translateY(-1px); }
.nav-link.active { animation: fadeIn .2s ease; }

/* Table row hover */
table tbody tr { transition: background .15s, transform .15s; }
table tbody tr:hover { background: rgba(32,201,151,.05); }

/* Announcement card hover */
.announcement-card { transition: all .25s ease; }
.announcement-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.3); }

/* Group card hover */
.group-card { transition: all .25s ease; }
.group-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.group-card.active { animation: glow 2s ease infinite; }

/* Welcome banner */
.welcome-banner { transition: transform .3s; }
.welcome-banner:hover { transform: translateY(-2px); }
.welcome-banner::after { transition: transform .5s; }
.welcome-banner:hover::after { transform: scale(1.2); }

/* Modal entrance */
.modal-overlay.open .modal-box { animation: bounceIn .3s ease; }

/* Form control focus */
.form-control { transition: border-color .25s, box-shadow .25s, background .25s; }
.form-control:focus { animation: glow 1.5s ease infinite; }

/* Flash messages */
.flash { animation: slideIn .3s ease, pulse .5s ease .3s; }

/* Grade badge hover */
.grade-badge, .grade-item { transition: transform .15s, box-shadow .15s; }
.grade-badge:hover, .grade-item:hover { transform: scale(1.15); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* Progress bar fill animation */
.progress-fill { animation: shimmer 2s ease infinite; background-size: 200% 100%; background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent); }

/* Pagination hover */
.pagination a { transition: all .2s ease; }
.pagination a:hover { transform: translateY(-2px); box-shadow: 0 2px 8px rgba(32,201,151,.3); }

/* Logout button */
.btn-logout { transition: all .25s ease; }
.btn-logout:hover { transform: rotate(90deg); }

/* Scroll-triggered fade-in */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .5s ease, transform .5s ease;
}
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.stagger-children > *:nth-child(1) { transition-delay: .05s; }
.stagger-children > *:nth-child(2) { transition-delay: .1s; }
.stagger-children > *:nth-child(3) { transition-delay: .15s; }
.stagger-children > *:nth-child(4) { transition-delay: .2s; }
.stagger-children > *:nth-child(5) { transition-delay: .25s; }
.stagger-children > *:nth-child(6) { transition-delay: .3s; }

/* Skeleton loading shimmer */
.skeleton {
    background: linear-gradient(90deg, #242424 25%, #2a2a2a 50%, #242424 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
    border-radius: 8px;
}

/* Navbar brand hover */
.navbar-brand { transition: transform .2s; }
.navbar-brand:hover { transform: scale(1.03); }

/* Logo spin on hover */
.navbar-logo { transition: transform .3s; }
.navbar-brand:hover .navbar-logo { transform: rotate(10deg); }
