:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: #334155;
    --font: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.align-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mt-15 {
    margin-top: 15px;
}

.mb-15 {
    margin-bottom: 15px;
}

h1,
h2,
h3,
h4 {
    letter-spacing: -0.5px;
}

label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 5px;
    margin-top: 10px;
}

.text-warning {
    color: var(--warning) !important;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.text-error {
    color: var(--error) !important;
}

/* Loader */
.screen-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Layout */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.content-area {
    margin-top: 60px;
    margin-bottom: 70px;
    padding: 20px;
    min-height: calc(100vh - 130px);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    gap: 4px;
    transition: 0.3s;
}

.nav-item i {
    font-size: 22px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    transform: translateY(-3px) scale(1.1);
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.statistic {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.statistic .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.statistic .label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.danger {
    background: linear-gradient(135deg, var(--error), #dc2626);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.btn.success {
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.btn.warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
    color: #fff;
}

.btn.outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
    box-shadow: none;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}

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

input,
select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 14px 15px;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: 0.3s;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.sync-indicator {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
}

.sync-indicator.online {
    color: var(--success);
}

.sync-indicator.offline {
    color: var(--error);
}

.sync-indicator.syncing {
    color: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 15px;
    }
}

/* Rental Item */
.rental-item {
    position: relative;
    overflow: hidden;
}

.rental-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--primary);
    transition: 0.3s;
}

.rental-item.running::before {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.rental-item.paused::before {
    background: var(--warning);
}

.rental-item.idle::before {
    background: var(--primary);
}

.rental-item.finished::before {
    background: var(--text-muted);
}

.rental-item.finished {
    opacity: 0.7;
}

.rental-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.rental-header .title {
    font-weight: 600;
    font-size: 18px;
}

.rental-header .badge {
    background: var(--border);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.rental-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 5px;
}

.rental-timer {
    font-size: 42px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    text-align: center;
    margin: 15px 0;
    color: var(--text-main);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    font-family: monospace;
}

.rental-timer.expired {
    color: var(--error);
    animation: blink 1s infinite;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.rental-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

@media (max-width: 480px) {
    .rental-actions {
        grid-template-columns: 1fr;
    }

    .rental-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .rental-info {
        flex-direction: column;
        gap: 4px;
    }

    .rental-timer {
        font-size: 32px;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

/* Login Page Redesign */
.login-container {
    height: 100vh;
    min-height: 100vh;
    display: flex;
    width: 100%;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(99, 102, 241, 0.8)), url('../img/login_bg.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(5px);
}

.login-left-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
}

.login-left-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.login-left-content p {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
    letter-spacing: 1px;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-dark);
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 20px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-header h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: #fff;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: 0.3s;
}

.input-group input {
    padding-left: 45px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-group input:focus+i,
.input-group input:focus~i {
    color: var(--primary);
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
        padding: 20px;
    }

    .login-left {
        display: none;
    }

    .login-right {
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(99, 102, 241, 0.9)), url('../img/login_bg.png') center/cover no-repeat;
        border-radius: 20px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }

    .login-box {
        backdrop-filter: blur(5px);
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 20px 10px;
    }
}

/* Bar Chart Styles */
.bar-wrap {
    height: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
}

.bar {
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    width: 100%;
    transition: 0.5s height ease-out;
    position: relative;
    min-height: 5px;
}

.bar span {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
}

.chart-tooltip {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 10px;
    opacity: 0;
    transition: 0.2s;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

.bar:hover .chart-tooltip {
    opacity: 1;
}

/* Unit Item */
.unit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.unit-info .name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.unit-info .code {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
}

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

.data-table th {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 600px) {
    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 15px;
        background: rgba(0, 0, 0, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }

    .data-table td {
        text-align: right;
        padding: 12px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        position: relative;
        padding-left: 45%;
        min-height: 44px;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        white-space: normal;
        word-break: break-word;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        width: 40%;
        text-align: left;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 11px;
    }

    .data-table td[colspan] {
        padding-left: 15px;
        text-align: center;
        justify-content: center;
    }

    .badge {
        font-size: 10px;
        padding: 4px 8px;
    }
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge.primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.badge.neutral {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

.badge.danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--primary);
    color: var(--text-main);
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    font-size: 14px;
    right: -100%;
    margin-left: auto;
    width: max-content;
    transition: 0.3s transform cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateX(150%);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}