/* Zmienne i ogólne ustawienia */
:root {
    --primary-color: #ff5e00; /* Pomarańczowy z logo RUSTEC */
    --primary-hover: #e05200;
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --text-main: #f0f0f0;
    --text-muted: #aaaaaa;
    --border-color: #333333;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
}

/* Navbar & Logo */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #000;
    padding: 15px 30px;
    border-bottom: 2px solid var(--primary-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Rysowanie logo za pomocą CSS, podobne do załącznika */
.hexagon {
    width: 50px;
    height: 55px;
    background-color: var(--primary-color);
    position: relative;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.r-letter {
    color: #121212;
    font-size: 32px;
    font-weight: 900;
    font-family: Arial, sans-serif;
    margin-top: -2px;
}

.brand-name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
}

.tm {
    font-size: 14px;
    color: var(--primary-color);
    vertical-align: super;
    margin-left: 2px;
}

.user-info {
    font-size: 14px;
    color: var(--text-muted);
}

.btn-logout {
    margin-left: 15px;
    color: var(--primary-color);
    text-decoration: none;
    border: 1px solid var(--primary-color);
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* Kontenery i layout */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Formularze i przyciski */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-muted);
}

input, select {
    width: 100%;
    padding: 10px;
    background-color: #2a2a2a;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 4px;
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    transition: background 0.3s;
}

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

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

.btn-block {
    display: block;
    width: 100%;
}

/* Logowanie */
.login-container {
    display: flex;
    justify-content: center;
    margin-top: 10vh;
}

.login-box {
    background-color: var(--bg-card);
    padding: 40px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.login-box h2 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.subtitle {
    margin-bottom: 30px;
    color: var(--text-muted);
    font-size: 14px;
}

.demo-info {
    margin-top: 30px;
    padding: 15px;
    background-color: #2a2a2a;
    border-radius: 4px;
    font-size: 13px;
}

.demo-info ul {
    margin-top: 10px;
    padding-left: 20px;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.card {
    background-color: var(--bg-card);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.card h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* Tabele */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-muted);
    font-weight: normal;
}

.low-stock {
    color: #ff4444;
    font-weight: bold;
}

.good-stock {
    color: #00C851;
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}
.badge-produkcja { background-color: #007bff; color: white; }
.badge-przyjecie { background-color: #28a745; color: white; }
.badge-wydanie { background-color: #dc3545; color: white; }

/* Powiadomienia */
.alerts {
    margin-bottom: 20px;
}

.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.alert-success { background-color: rgba(40, 167, 69, 0.2); border: 1px solid #28a745; color: #28a745; }
.alert-danger { background-color: rgba(220, 53, 69, 0.2); border: 1px solid #dc3545; color: #ff6b6b; }
.alert-warning { background-color: rgba(255, 193, 7, 0.2); border: 1px solid #ffc107; color: #ffc107; }
.alert-info { background-color: rgba(23, 162, 184, 0.2); border: 1px solid #17a2b8; color: #17a2b8; font-weight: bold; }
/* Dropdown Menu CSS appended */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropbtn {
    background-color: transparent;
    color: #fff;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s;
    text-decoration: none;
}
.dropdown:hover .dropbtn, .dropbtn:hover {
    background-color: #333;
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #2a2a2a;
    min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.7);
    z-index: 1000;
    border-radius: 4px;
    border: 1px solid #444;
    overflow: hidden;
}
.dropdown-content a {
    color: #f0f0f0;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    border-bottom: 1px solid #333;
}
.dropdown-content a:last-child {
    border-bottom: none;
}
.dropdown-content a:hover {
    background-color: var(--primary-color);
    color: #fff;
}
.dropdown:hover .dropdown-content {
    display: block;
}
/* Light Theme Overrides */
body.light-theme {
    --bg-dark: #f4f6f9;
    --bg-card: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
}
body.light-theme .navbar {
    background-color: #ffffff;
    border-bottom: 2px solid var(--primary-color);
}
body.light-theme .sub-navbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}
body.light-theme .dropbtn {
    color: #212529;
}
body.light-theme .dropdown-content {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
}
body.light-theme .dropdown-content a {
    color: #212529;
    border-bottom: 1px solid #f1f1f1;
}
body.light-theme input, body.light-theme select {
    background-color: #fff;
    color: #212529;
    border: 1px solid #ced4da;
}
body.light-theme .data-table th {
    color: #495057;
}
body.light-theme .r-letter {
    color: #ffffff;
}
body.light-theme .demo-info {
    background-color: #e9ecef;
}

/* ========================================================================== */
/* RESPONSYWNOŚĆ I WSPARCIE DLA URZĄDZEŃ MOBILNYCH (SMARTFONY, TABLETY)      */
/* ========================================================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
}

/* Zapobieganie rozciąganiu ekranu na telefonach */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Responsywny pasek nawigacyjny górny i podmenu */
@media (max-width: 992px) {
    .container {
        max-width: 100%;
        margin: 15px auto;
        padding: 0 12px;
    }
    .navbar {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .user-info {
        font-size: 12px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    .sub-navbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sub-navbar .dropbtn {
        padding: 6px 10px;
        font-size: 13px;
        white-space: nowrap;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 12px;
    }
    .logo-container {
        width: 100%;
        justify-content: space-between;
    }
    .user-info {
        width: 100%;
        justify-content: space-between;
        margin-top: 5px;
        border-top: 1px solid #262626;
        padding-top: 8px;
    }
    .btn-logout {
        margin-left: auto;
    }
    .sub-navbar {
        padding: 8px 10px;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
    }
    .sub-navbar .dropbtn,
    .sub-navbar form button {
        flex-shrink: 0;
        font-size: 12.5px;
        padding: 6px 10px;
    }
    .card {
        padding: 14px 12px;
        margin-bottom: 12px;
        border-radius: 6px;
    }
    .card h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    /* Automatyczne przewijanie tabel na małych ekranach */
    .data-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .data-table th, .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* Przyciski i formularze - dotykowe (min. 40px) */
    .btn {
        padding: 9px 14px;
        font-size: 13px;
    }
    
    /* Karta zamówienia w module wysyłek i na dashboardzie */
    .order-dispatch-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .order-dispatch-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    .order-dispatch-actions .btn,
    .order-dispatch-actions form,
    .order-dispatch-actions form button {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 10px 14px !important;
    }
    
    /* Grid konfiguracji w inpost_panel */
    .cfg-grid {
        grid-template-columns: 1fr !important;
    }
    .login-container {
        margin-top: 20px;
        padding: 0 10px;
    }
    .login-box {
        padding: 24px 18px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 8px;
        margin: 10px auto;
    }
    .card {
        padding: 12px 10px;
    }
    .brand-name {
        font-size: 22px;
    }
    .hexagon {
        width: 40px;
        height: 44px;
    }
    .r-letter {
        font-size: 24px;
    }
}
