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

:root {
    --bg-dark: #0a1120;
    --card-bg: rgba(17, 28, 46, 0.7);
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --text: #e4e6eb;
    --text-muted: #a3b8cc;
    --border: #253a5a;
    --success: #34c759;
    --warning: #ffb31a;
    --red: #ff4d4d;
}

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

body {
    background: radial-gradient(circle at top right, #1a2a4a, var(--bg-dark));
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 500;
}

/* ================================================
   AUTH PAGES (centering)
   ================================================ */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding-bottom: 50px; /* offset for footer */
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 3rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.8s ease-out;
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin-bottom: 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.btn-logout:hover {
    background: rgba(255, 77, 77, 0.1);
    border-color: var(--red);
}

.btn-view {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1.5px solid rgba(56, 189, 248, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 0.5rem;
}

.btn-view:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
    border-color: var(--accent);
    user-select: none;
}

.btn-view svg {
    transition: transform 0.3s;
}

.btn-view:hover svg {
    transform: scale(1.1);
}

.auth-input {
    background: rgba(10, 17, 32, 0.8);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    color: white;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    background: rgba(10, 17, 32, 1);
}

.auth-btn {
    background: linear-gradient(135deg, #2564b0, #38bdf8);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 1.1rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
    box-shadow: 0 8px 30px rgba(56, 189, 248, 0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(56, 189, 248, 0.5);
    user-select: none;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.remember-group {
    margin: 0.5rem 0;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
}

.remember-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

/* ================================================
   USER BAR & DASHBOARD
   ================================================ */
.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.2rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    font-size: 1.8rem;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-email {
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
}

.search-wrapper {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    background: #0a1120;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 1.1rem;
}

/* ================================================
   TABLE (SORTABLE)
   ================================================ */
.table-card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1.5rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1.5px;
    border-bottom: 2px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

th:hover {
    background: rgba(56, 189, 248, 0.1);
}

th::after {
    content: ' ↕';
    font-size: 0.8rem;
    opacity: 0.5;
}

td {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
}

.badge.w-toku { background: rgba(255, 179, 26, 0.15); color: var(--warning); border: 1px solid rgba(255, 179, 26, 0.4); }
.badge.zakonczony { background: rgba(52, 199, 89, 0.15); color: var(--success); border: 1px solid rgba(52, 199, 89, 0.4); }

/* Footer */
footer {
    text-align: center;
    padding: 2.5rem 0;
    color: var(--text-muted);
    font-size: 1rem;
}

/* Animations */
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } }

/* ================================================
   RESPONSIVE DESIGN (Mobile First)
   ================================================ */

@media (max-width: 1024px) {
    .container { padding: 1.5rem 1rem; }
    h1 { font-size: 2.2rem; }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    .subtitle { font-size: 1rem; }
    .auth-card { padding: 2rem; }
    .user-bar { padding: 1rem 1.5rem; }
    
    /* Table paddings reduction */
    th, td { padding: 1rem 0.8rem; }
    td { font-size: 1rem; }
}

@media (max-width: 650px) {
    /* User bar stacking */
    .user-bar {
        flex-direction: column;
        gap: 1.2rem;
        text-align: center;
        padding: 1.5rem;
    }
    
    .user-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Transform Table to Cards */
    .table-card {
        background: transparent;
        box-shadow: none;
        border: none;
        padding: 0;
        overflow-x: visible;
    }

    #ordersTable, 
    #ordersTable thead, 
    #ordersTable tbody, 
    #ordersTable tr, 
    #ordersTable td {
        display: block;
        width: 100%;
    }

    #ordersTable thead {
        display: none; /* Hide headers */
    }

    #ordersTable tr {
        background: var(--card-bg);
        margin-bottom: 1.5rem;
        border-radius: 20px;
        padding: 1.2rem;
        border: 1px solid var(--border);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        animation: fadeInUp 0.5s ease-out;
    }

    #ordersTable td {
        text-align: right;
        padding: 0.8rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-height: 45px;
        font-size: 1rem;
    }

    #ordersTable td:last-child {
        border-bottom: none;
        flex-direction: column;
        align-items: flex-end;
        padding-top: 1rem;
    }

    /* Labels using data-label attribute */
    #ordersTable td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--accent);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 1px;
        text-align: left;
        flex: 1;
        margin-right: 15px;
    }

    /* Specific column adjustments */
    .col-id {
        font-size: 1.2rem !important;
        color: #fff !important;
        border-bottom: 2px solid var(--border) !important;
        margin-bottom: 0.5rem;
        padding-bottom: 1rem !important;
    }
    
    .col-results {
        text-align: right;
        color: var(--text) !important;
        background: rgba(0, 0, 0, 0.2);
        padding: 1rem !important;
        border-radius: 12px;
        margin-top: 0.5rem;
    }

    .badge {
        padding: 0.4rem 0.8rem;
    }

    .btn-view {
        width: 100%;
        justify-content: center;
        padding: 0.8rem;
        margin-top: 0.5rem;
    }
}

@media (max-width: 400px) {
    h1 { font-size: 1.8rem; }
    .search-input { font-size: 1rem; padding: 0.8rem 1.2rem; }
}
