/* =========================================
   1. GLOBALNE ZMIENNE I RESET
   ========================================= */
:root {
    --bg-body: #121212;       /* Tło całej strony */
    --bg-panel: #1e1e1e;      /* Tło kafelków/paneli */
    --bg-lighter: #2d2d2d;    /* Tło inputów/nagłówków tabel */
    --border: #444;           /* Kolor ramek */
    
    --text-main: #e0e0e0;     /* Główny tekst */
    --text-muted: #a0a0a0;    /* Szary tekst */
    
    --accent-red: #e63946;    /* Czerwony (Akcent główny) */
    --accent-blue: #007acc;   /* Niebieski (Linki, Info) */
    --accent-green: #2a9d8f;  /* Zielony (Sukces, Zatwierdź) */
    --accent-yellow: #e9c46a; /* Żółty (Pending, Ostrzeżenia) */
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
a:hover { color: var(--accent-blue); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* =========================================
   2. NAWIGACJA (Górny Pasek)
   ========================================= */
.navbar {
    background: rgba(30, 30, 30, 0.95);
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

h1 span{color: var(--accent-red);}

.logo { display: flex; align-items: center; gap: 10px; }
.logo img { height: 45px; width: auto; }
.logo span { font-weight: bold; font-size: 1.2rem; }

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { font-weight: 500; font-size: 0.95rem; color: var(--text-main); }
.nav-links a:hover { color: var(--accent-blue); }

.user-menu { display: flex; align-items: center; gap: 10px; }
.user-menu img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--accent-blue); }

.btn-login {
    background: var(--accent-blue);
    color: white !important;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: bold;
}

/* Responsywność Menu */
@media (max-width: 768px) {
    .navbar { flex-direction: column; gap: 15px; padding: 15px; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
}

/* =========================================
   3. PRZYCISKI I FORMULARZE
   ========================================= */
.btn {
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    color: white;
    display: inline-block;
    text-align: center;
    font-size: 0.9rem;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); color:rgb(153,255,0)}

.btn-red { background: var(--accent-red); }
.btn-blue { background: var(--accent-blue); }
.btn-green { background: var(--accent-green); }
.btn-gray { background: #444; }

/* Inputy */
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="file"],  input[type="email"], textarea, select {
    width: 100%;
    background: var(--bg-lighter);
    border: 1px solid #555;
    color: white;
    padding: 10px;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 10px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent-blue); }

/* =========================================
   4. STRONA GŁÓWNA (Hero & Grid)
   ========================================= */
.hero {
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.8)), url('images/banner.jpeg');
    background-size: cover;
    background-position: center;
    height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    border-bottom: 4px solid var(--accent-red);
}
.hero h1 { font-size: 2.5rem; margin: 0 0 10px 0; text-transform: uppercase; letter-spacing: 2px; }
.hero p { font-size: 1.1rem; color: #ccc; max-width: 600px; margin-bottom: 25px; }
.hero-btn { background: var(--accent-red); color: white; padding: 12px 30px; border-radius: 5px; font-weight: bold; font-size: 1.1rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.card {
    background: var(--bg-panel); padding: 30px; border-radius: 8px; border: 1px solid #333;
    transition: 0.3s; text-align: center; position: relative;
}
.card:hover { transform: translateY(-5px); border-color: var(--accent-blue); box-shadow: 0 10px 20px rgba(0,0,0,0.3); }
.card-icon { font-size: 2.5rem; margin-bottom: 15px; display: block; }
.card-link { display: inline-block; padding: 8px 16px; border: 1px solid #555; border-radius: 4px; margin-top: 15px; }
.card.disabled { opacity: 0.5; pointer-events: none; }
.badge-soon { position: absolute; top: 10px; right: 10px; background: #333; padding: 3px 8px; font-size: 0.7rem; border-radius: 4px; }

/* =========================================
   5. BAZA MATERIAŁÓW (baza.php)
   ========================================= */
.main-header { text-align: center; margin-bottom: 40px; border-bottom: 1px solid #333; padding-bottom: 30px; }
.logo-img { height: 60px; width: auto; margin-bottom: 10px; }
.search-box { width: 100%; max-width: 500px; margin: 0 auto 30px auto; }
.search-input { border-radius: 30px; text-align: center; }

.power-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 30px; flex-wrap: wrap; }
.power-tab { 
    padding: 8px 20px; background: var(--bg-lighter); border: 2px solid #444; 
    color: #aaa; border-radius: 30px; font-weight: bold; font-size: 0.9rem;
}
.power-tab.active, .power-tab:hover { background: var(--accent-blue); border-color: var(--accent-blue); color: white; }

.materials-wrapper { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 50px; }
.material-card { background: #252526; border: 1px solid #333; border-radius: 8px; padding: 20px; transition: 0.2s; }
.material-card:hover { border-color: #555; background: #2d2d2d; }
.mat-name { font-weight: bold; margin-bottom: 10px; color: #fff; font-size: 1.1rem; border-bottom: 1px solid #333; padding-bottom: 10px;}

.thickness-list { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-thick { 
    background: #333; padding: 5px 10px; border-radius: 4px; font-size: 0.9rem; 
    border: 1px solid #444; color: #e0e0e0;
}
.btn-thick:hover { background: var(--accent-blue); border-color: var(--accent-blue); color: white; }

/* Słownik */
/* --- SEKCJA 2: SŁOWNIK (DÓŁ) --- */
        .dictionary-interface {
            display: grid; grid-template-columns: 200px 1fr 350px; 
            background: var(--panel-bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; min-height: 500px;
        }

        /* Sidebar filtrów */
        .dict-sidebar { background: #252526; border-right: 1px solid var(--border); padding: 10px; }
        .cat-btn { display: block; width: 100%; padding: 10px; background: none; border: none; color: #888; text-align: left; cursor: pointer; font-weight: 600; transition: 0.2s; border-radius: 4px; margin-bottom: 5px; }
        .cat-btn:hover { color: #fff; background: #333; }
        .cat-btn.active { color: #fff; background: var(--accent); }

        /* Grid parametrów */
        .dict-grid { padding: 20px; overflow-y: auto; max-height: 1500px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; align-content: start; }
        .dict-item { background: #3c3c3c; padding: 15px; border-radius: 4px; border: 1px solid var(--border); cursor: pointer; transition: 0.2s; }
        .dict-item:hover { border-color: var(--accent); transform: translateY(-2px); }
        .dict-item.selected { background: #444; border-color: var(--highlight); box-shadow: 0 0 10px rgba(230,57,70,0.2); }
        .dict-key { color: var(--accent-red); font-size: 0.75rem; font-family: monospace; display: block; margin-bottom: 4px; }
        .dict-name { font-weight: bold; font-size: 0.9rem; }

        /* Panel Info */
        .dict-info { background: #202020; border-left: 1px solid var(--border); padding: 25px; color: #ccc; }
        .info-header { border-bottom: 1px solid #444; padding-bottom: 10px; margin-bottom: 15px; }
        .info-title { font-size: 1.4rem; color: #fff; margin: 0; }
        .info-subtitle { color: var(--highlight); font-family: monospace; font-size: 0.9rem; margin-top: 5px; }
        .info-desc { line-height: 1.6; margin-bottom: 20px; }
        .info-tip { background: rgba(0, 122, 204, 0.15); border-left: 3px solid var(--accent); padding: 15px; font-size: 0.9rem; color: #fff; }

        /* Responsywność */
        @media (max-width: 900px) {
            .dictionary-interface { grid-template-columns: 1fr; }
            .dict-sidebar { display: flex; overflow-x: auto; padding-bottom: 5px; }
            .cat-btn { white-space: nowrap; width: auto; margin-right: 10px; }
            .dict-info { border-left: none; border-top: 1px solid var(--border); min-height: 300px; }
        }; }

/* =========================================
   6. SZCZEGÓŁY MATERIAŁU (material.php) - NAPRAWIONE
   ========================================= */
/* Pasek narzędziowy nad kartą (zastępuje position:absolute) */
.nav-top { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
}
.btn-home { color: #888; display: inline-flex; align-items: center; font-size: 0.9rem; }
.btn-home:hover { color: #fff; }

.tech-sheet { max-width: 1000px; margin: 0 auto; padding-bottom: 100px; }

/* Nagłówek wewnątrz karty materiału */
.mat-detail-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid var(--border); padding-bottom: 20px; margin-bottom: 30px;
}
.mat-detail-title h1 { margin: 0; font-size: 2rem; color: #fff; }
.mat-detail-title span { color: var(--accent-red); font-size: 1.5rem; font-weight: 300; }

/* Siatka parametrów */
.param-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; margin-bottom: 30px; }

.sub-label { display: block; font-size: 0.65rem; color: var(--accent-red); text-transform: capitalize; margin-top: 2px; font-weight: normal;}

/* Tooltip (Dymek) */
.tooltip { position: relative; cursor: help; }

/* Sekcje */
        .section-header { padding: 20px 20px 10px 20px; color: var(--accent); text-transform: uppercase; font-weight: bold; font-size: 1.1rem; border-bottom: 1px solid #333; margin-top: 20px; }
        
        .grid_material { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; padding: 20px; }

        /* Kafelki */
        .param-card { background: #383838; padding: 15px; border-radius: 6px; border: 1px solid #444; position: relative; cursor: help; transition: 0.2s; }
        .param-card:hover { border-color: var(--accent); transform: translateY(-2px); }
        .label { font-size: 0.75rem; color: #aaa; text-transform: uppercase; margin-bottom: 5px; min-height: 20px; }
        .value { font-size: 1.2rem; font-weight: bold; color: #fff; font-family: 'Consolas', monospace; word-break: break-all; }
        .unit { font-size: 0.7rem; color: var(--accent); margin-left: 3px; }

        /* Notatki */
        .notes-box { background: #252526; padding: 20px; margin: 20px; border-left: 4px solid var(--accent); color: #ccc; line-height: 1.6; }

        /* Tooltip */
        .tooltip:hover::after {
            content: attr(data-tip); /* Nie obsługuje HTML w samym attr, ale dla prostoty wystarczy */
            position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%);
            background: #000; color: #fff; padding: 12px; border-radius: 6px;
            width: 250px; font-size: 0.85rem; z-index: 100; pointer-events: none;
            box-shadow: 0 5px 15px rgba(0,0,0,0.6); text-align: left;
            white-space: pre-wrap; /* Pozwala na łamanie linii */
        }


/* Komentarze */
.comments-section { background: #252526; padding: 20px; border-radius: 8px; border-top: 3px solid var(--accent-blue); margin-top: 40px; }
.comment-box { background: #333; padding: 15px; border-radius: 5px; margin-bottom: 15px; border-left: 2px solid #555; }
.comm-user { color: var(--accent-blue); font-weight: bold; font-size: 0.9rem; margin-bottom: 5px; }
.comm-date { float: right; font-size: 0.7rem; color: #777; }

/* =========================================
   7. PANEL ADMINA & EDYCJA (admin.php, admin_edit.php)
   ========================================= */
table { width: 100%; border-collapse: collapse; background: var(--bg-lighter); border-radius: 8px; overflow: hidden; margin-top: 20px; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #252526; text-transform: uppercase; font-size: 0.8rem; color: #888; }
tr:hover { background: #333; }

/* Formularz edycji */
.section-title { color: var(--accent-red); border-left: 4px solid var(--accent-red); padding-left: 10px; margin: 30px 0 15px 0; font-weight: bold; text-transform: uppercase; font-size: 1.1rem; }
.input-group { background: var(--bg-lighter); padding: 15px; border-radius: 5px; border: 1px solid #444; }
.input-group label { display: block; font-size: 0.85rem; color: #aaa; margin-bottom: 5px; }
.eng-label { display: block; font-size: 0.7rem; color: #555; margin-top: 2px; text-transform: capitalize; }
.save-bar { position: fixed; bottom: 0; left: 0; width: 100%; background: #111; padding: 15px; text-align: center; border-top: 2px solid var(--accent-red); box-shadow: 0 -5px 20px rgba(0,0,0,0.5); z-index: 999; }

/* Logowanie */
.login-box { background: var(--bg-lighter); padding: 40px; border-radius: 8px; text-align: center; border: 1px solid #444; max-width: 400px; margin: 100px auto; }
.error { color: #ff4d4d; margin-bottom: 15px; }

/* =========================================
   8. FORUM (forum.php, question.php)
   ========================================= */
        .user-panel { display: flex; align-items: center; gap: 15px; }
        .avatar { width: 35px; height: 35px; border-radius: 50%; border: 2px solid #007acc; }
        .user-name { font-weight: bold; font-size: 0.9rem; }
        .btn-logout { color: #aaa; text-decoration: none; font-size: 0.8rem; }
        .btn-logout:hover { color: #e63946; }

        /* Kontener */
        .container { max-width: 1100px; margin: 30px auto; padding: 20px; }
        
        /* Nagłówek sekcji */
        .forum-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
        .btn-ask { background: #007acc; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; font-weight: bold; transition: 0.2s; }
        .btn-ask:hover { background: #006bb3; }

        /* Lista pytań */
        .question-card { background: #2d2d2d; padding: 20px; border-radius: 8px; margin-bottom: 15px; border: 1px solid #444; transition: 0.2s; display: flex; gap: 20px; }
        .question-card:hover { border-color: #007acc; transform: translateY(-2px); }
        
        .q-stats { text-align: center; min-width: 60px; display: flex; flex-direction: column; justify-content: center; }
        .stat-box { background: #1e1e1e; padding: 5px; border-radius: 4px; border: 1px solid #333; margin-bottom: 5px; }
        .stat-num { font-size: 1.1rem; font-weight: bold; color: #e63946; display: block; }
        .stat-label { font-size: 0.6rem; color: #888; text-transform: uppercase; }

        .q-content { flex-grow: 1; }
        .q-title { font-size: 1.2rem; font-weight: bold; color: #fff; text-decoration: none; display: block; margin-bottom: 8px; }
        .q-title:hover { color: #007acc; }
        .q-excerpt { color: #aaa; font-size: 0.9rem; margin-bottom: 10px; line-height: 1.4; }
        
        .q-meta { font-size: 0.8rem; color: #666; display: flex; align-items: center; gap: 10px; }
        .meta-author img { width: 20px; height: 20px; border-radius: 50%; vertical-align: middle; margin-right: 5px;}

/* =========================================
   9. STOPKA I EXTRASY
   ========================================= */
footer {
    background: #000; padding: 40px 20px; text-align: center; 
    border-top: 1px solid #222; color: #666; font-size: 0.9rem; margin-top: 50px;
}
.stats-bar { background: #111; color: #666; font-size: 0.8rem; padding: 10px; margin-top: 20px; font-family: monospace; }
.stats-val { color: var(--accent-red); font-weight: bold; }
.ad-banner { max-width: 1200px; margin: 0 auto 50px auto; background: #111; border: 1px dashed #444; height: 120px; display: flex; justify-content: center; align-items: center; color: #555; text-transform: uppercase; }

/* =========================================
   10. EKRAN LOGOWANIA (login.php)
   ========================================= */

/* Specjalne ustawienie dla całej strony logowania */
.login-body {
    background: linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.9)), url('https://images.unsplash.com/photo-1565439398532-39920197793d?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    height: 100vh; /* Cała wysokość ekranu */
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.login-card {
    background: #1e1e1e;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #333;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

/* Ozdobny pasek na górze */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-red));
}

.login-logo {
    width: 80px;
    height: auto;
    margin-bottom: 20px;
}

.login-title {
    color: #fff;
    font-size: 1.5rem;
    margin: 0 0 10px 0;
}

.login-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

/* Przycisk Google */
.btn-google {
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    transition: 0.2s;
    font-family: 'Segoe UI', sans-serif;
    border: 1px solid #ddd;
}
.btn-google:hover {
    background: #f1f1f1;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    color: #000;
}
.google-icon {
    width: 20px;
    height: 20px;
}

.admin-link {
    display: block;
    margin-top: 30px;
    font-size: 0.8rem;
    color: #444;
}
.admin-link:hover { color: var(--accent-red); }

.notebook-header {
            display: flex; justify-content: space-between; align-items: center;
            border-bottom: 2px solid var(--accent-blue); padding-bottom: 20px; margin-bottom: 30px;
        }
        .notebook-grid {
            display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
        }
        .note-card {
            background: var(--bg-lighter); border: 1px solid #444; border-radius: 8px; padding: 20px; position: relative;
        }
        .note-card:hover { border-color: var(--accent-blue); }
        
        .note-actions {
            margin-top: 15px; border-top: 1px solid #333; padding-top: 10px;
            display: flex; justify-content: space-between;
        }
        .btn-sm { font-size: 0.8rem; padding: 5px 10px; border-radius: 4px; }
        .empty-state { text-align: center; padding: 50px; color: #777; border: 2px dashed #333; border-radius: 10px; }
        
        .owner-header {
            display: flex;
            align-items: center;
            gap: 15px;
            text-align: right;
        }
        .owner-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: 2px solid var(--accent-blue);
            object-fit: cover;
        }
        
   /* --- STYL KOMENTARZY (POPRAWIONY) --- */

.comment-item {
    background-color: #1e1e1e;   /* Ciemne tło */
    border: 1px solid #333;      /* Subtelna ramka */
    border-radius: 8px;          /* Zaokrąglone rogi */
    padding: 20px;               /* Odstępy wewnątrz */
    margin-bottom: 20px;         /* Odstęp między komentarzami */
    transition: transform 0.2s ease, border-color 0.2s;
}

.comment-item:hover {
    border-color: #555;          /* Jaśniejsza ramka po najechaniu */
}

.comment-header {
    display: flex;
    align-items: center;         /* Wyrównanie awatara i tekstu w pionie */
    gap: 15px;                   /* Odstęp między awatarem a tekstem */
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2a2a; /* Linia oddzielająca nagłówek */
}

.comment-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;          /* Idealne koło */
    object-fit: cover;           /* Zapobiega spłaszczeniu zdjęcia */
    border: 2px solid #444;      /* Ramka wokół zdjęcia */
}

.comment-meta {
    display: flex;
    flex-direction: column;      /* Imię nad datą */
}

.comment-author {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
}

.comment-author.link:hover {
    color: var(--accent-blue);   /* Podświetlenie linku */
    text-decoration: underline;
}

.comment-date {
    color: #888;
    font-size: 0.75rem;
    margin-top: 2px;
}

.comment-body {
    color: #ddd;                 /* Jasnoszary tekst */
    line-height: 1.6;            /* Wygodne czytanie */
    font-size: 0.95rem;
}     

/* --- KARTA AUTORA (material.php) --- */
.author-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px; /* Odstęp od tytułu H1 */
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.author-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-blue);
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.author-name-link {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    transition: 0.2s;
}

.author-name-link:hover {
    color: var(--accent-blue);
}

.author-name-text {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
}

/* Responsywność na telefonach */
@media (max-width: 600px) {
    .author-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}

/* --- STRONICOWANIE (PAGINACJA) --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.page-btn {
    padding: 8px 12px;
    background-color: #333;
    color: #ccc;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #444;
    transition: 0.2s;
}

.page-btn:hover {
    background-color: #444;
    color: white;
}

.page-btn.active {
    background-color: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    font-weight: bold;
}