/* ========================================
   TCUN NETWORK - MikroTik Management Styles
   Ultra Professional Corporate Design
   ======================================== */

/* CSS Variables - Corporate Color Palette */
:root {
    /* Primary Brand Colors - More Corporate */
    --primary-dark: #0d1b2a;
    --primary-medium: #1b263b;
    --primary-light: #415a77;

    /* Accent Colors - More Conservative */
    --accent-primary: #1976d2;
    --accent-secondary: #0288d1;
    --accent-tertiary: #00695c;

    /* Status Colors */
    --success: #2e7d32;
    --warning: #f57c00;
    --danger: #c62828;
    --info: #1565c0;

    /* Text Colors */
    --text-primary: #e8eaf6;
    --text-secondary: #9fa8da;
    --text-muted: #7986cb;

    /* UI Elements */
    --border-color: #283593;
    --divider: #3949ab;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);

    /* Gradients - More Subtle */
    --gradient-primary: linear-gradient(135deg, #1b263b 0%, #0d1b2a 100%);
    --gradient-accent: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    --gradient-card: linear-gradient(145deg, #1b263b 0%, #0d1b2a 100%);
}

/* Helpers */
.muted{color:var(--text-muted)}

/* Reset & Base Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--primary-dark); color: var(--text-primary); font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; line-height: 1.6; padding: 20px; min-height: 100vh; }
.container { max-width: 1400px; margin: 0 auto; }

/* Header */
header { display: flex; justify-content: space-between; align-items: center; background: var(--gradient-card); padding: 1.25rem 2rem; border-radius: 12px; margin-bottom: 28px; box-shadow: var(--shadow-md); border: 1px solid var(--border-color); position: relative; overflow: hidden; }
header::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--gradient-accent); }
.logo { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); letter-spacing: 0.3px; display: flex; align-items: center; gap: 10px; }
.logo::before { content: '▪'; font-size: 1.5rem; color: var(--accent-primary); }
.logout-btn { background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%); color: white; border: none; padding: 10px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; box-shadow: var(--shadow-sm); font-size: 0.9rem; }
.logout-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* Header actions + hamburger (mobile) */
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.nav-toggle:focus { outline: none; box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.25); }

/* Card */
.card { background: var(--gradient-card); border-radius: 12px; padding: 24px; margin-bottom: 28px; box-shadow: var(--shadow-md); border: 1px solid var(--border-color); transition: box-shadow 0.3s ease; }
.card:hover { box-shadow: var(--shadow-lg); }
.card h2 { font-size: 1.3rem; margin-bottom: 20px; color: var(--text-primary); padding-bottom: 12px; border-bottom: 1px solid var(--divider); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card h2::before { content: ''; width: 3px; height: 20px; background: var(--accent-primary); border-radius: 2px; }

/* Forms */
form { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
input[type="text"], input[type="password"], select, input[type="number"], input[type="date"] { padding: 11px 16px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--primary-dark); color: var(--text-primary); font-family: inherit; font-size: 0.95rem; min-width: 200px; flex: 1; transition: all 0.3s ease; }
input[type="text"]:focus, input[type="password"]:focus, select:focus, input[type="number"]:focus, input[type="date"]:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.15); background: var(--primary-medium); }
input[type="text"]::placeholder { color: var(--text-muted); }

/* Buttons */
.btn { padding: 11px 20px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.3s ease; font-size: 0.9rem; text-decoration: none; display: inline-block; text-align: center; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary { background: var(--gradient-accent); color: white; }
.btn-success { background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%); color: white; }
.btn-warning { background: linear-gradient(135deg, #f57c00 0%, #e65100 100%); color: white; }
.btn-danger { background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%); color: white; }
.btn-purple { background: linear-gradient(135deg, #6a1b9a 0%, #4a148c 100%); color: white; }
.btn-secondary { background: #64748b; color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Lists */
ul { list-style: none; }
li { padding: 14px 16px; margin: 10px 0; background: var(--primary-medium); border-radius: 10px; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; border: 1px solid var(--border-color); transition: all 0.3s ease; }
li:hover { background: var(--primary-light); border-color: var(--accent-primary); }
li>div { display: flex; gap: 10px; align-items: center; }
.client-number { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; background: var(--gradient-accent); color: white; border-radius: 6px; font-weight: 700; font-size: 0.85rem; margin-right: 8px; }
.cut-client { background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%); color: white; padding: 5px 10px; border-radius: 5px; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* Traffic Info */
.traffic-info { display: flex; gap: 16px; margin-top: 20px; }
.traffic-box { background: var(--primary-medium); padding: 16px; border-radius: 10px; text-align: center; flex: 1; font-weight: 600; color: var(--accent-secondary); border: 1px solid var(--border-color); font-size: 1.05rem; }

/* Canvas */
canvas { max-width: 100%; height: 280px !important; border-radius: 8px; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: none; overflow-y: auto; }
.modal-dialog { position: relative; margin: 10vh auto; max-width: 500px; padding: 28px; background: var(--gradient-card); border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); color: var(--text-primary); }
.modal-content { margin-bottom: 15px; }
.modal-close { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }

/* Login Page */
.login-container { background: var(--gradient-card); padding: 3rem; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 450px; text-align: center; margin: 10vh auto; border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.login-container::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gradient-accent); }
.login-container h2 { margin-bottom: 2rem; color: var(--text-primary); font-weight: 700; font-size: 1.8rem; }
.login-container input { width: 100%; padding: 14px 18px; margin: 10px 0; border: 1px solid var(--border-color); border-radius: 8px; background: var(--primary-dark); color: var(--text-primary); font-size: 1rem; transition: all 0.3s ease; }
.login-container input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.15); }
.login-container button { width: 100%; padding: 14px; background: var(--gradient-accent); color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; margin-top: 1.5rem; font-size: 1.05rem; transition: all 0.3s ease; }
.login-container button:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.error { color: var(--danger); margin-top: 1.5rem; font-weight: 500; padding: 12px; background: rgba(198, 40, 40, 0.1); border-radius: 8px; border: 1px solid rgba(198, 40, 40, 0.3); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--primary-dark); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }

/* Custom Tables for Invoices */
.table-responsive { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; color: var(--text-primary); }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: var(--primary-medium); font-weight: 600; }
tr:hover { background-color: rgba(255, 255, 255, 0.05); }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; }
.badge-success { background-color: rgba(46, 125, 50, 0.2); color: #81c784; }
.badge-warning { background-color: rgba(245, 124, 0, 0.2); color: #ffb74d; }
.badge-danger { background-color: rgba(198, 40, 40, 0.2); color: #e57373; }

/* Responsive Design */
@media (max-width: 768px) {
    body { padding: 12px; }
    header { padding: 1rem 1.25rem; flex-direction: column; gap: 15px; }
    /* Mobile menu */
    .nav-toggle { display: inline-flex; }
    .header-actions { display: none; width: 100%; flex-direction: column; align-items: stretch; }
    .header-actions.open { display: flex; }
    .header-actions a, .header-actions button { width: 100%; }
    .logo { font-size: 1.2rem; }
    form { flex-direction: column; }
    input[type="text"], input[type="password"], select, .btn { width: 100%; }
    .traffic-info { flex-direction: column; }
    li { flex-direction: column; align-items: flex-start; gap: 12px; }
    li>div { width: 100%; flex-wrap: wrap; }
    .card { padding: 18px; }
}
.hidden { display: none; }

/* --- Pro UI helpers (new) --- */
.page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}
.page-header h1{margin:0;font-size:22px}
.page-header .muted{margin:6px 0 0;color:rgba(255,255,255,0.75);max-width:900px}
.actions-right{display:flex;gap:10px;align-items:center}

.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.form-row{display:flex;flex-direction:column;gap:8px}
.form-row label{font-weight:600;color:rgba(255,255,255,0.9)}
.form-row input,.form-row textarea{width:100%;padding:12px;border-radius:10px;border:1px solid rgba(255,255,255,0.18);background:rgba(0,0,0,0.25);color:#fff;outline:none}
.form-row input:focus,.form-row textarea:focus{border-color:rgba(115,125,255,0.55);box-shadow:0 0 0 3px rgba(115,125,255,0.18)}
.help{margin:0;color:rgba(255,255,255,0.72);font-size:13px}
.full{grid-column:1 / -1}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 14px;border-radius:10px;border:1px solid rgba(255,255,255,0.15);background:rgba(255,255,255,0.1);color:#fff;text-decoration:none;cursor:pointer}
.btn:hover{background:rgba(255,255,255,0.14)}
.btn.primary{background:linear-gradient(135deg,rgba(78,110,255,0.95),rgba(151,71,255,0.95));border:none}
.btn.primary:hover{filter:brightness(1.05)}
.btn.secondary{background:rgba(255,255,255,0.08)}

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

.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    background: var(--primary-medium);
    border-radius: 10px;
    border-left: 4px solid var(--accent-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.toast-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-primary);
}

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

.toast-success .toast-icon {
    background: var(--success);
    color: white;
}

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

.toast-error .toast-icon {
    background: var(--danger);
    color: white;
}

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

.toast-warning .toast-icon {
    background: var(--warning);
    color: white;
}

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

.toast-info .toast-icon {
    background: var(--info);
    color: white;
}

/* Global Loading Spinner */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 27, 42, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.global-loader.show {
    display: flex;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.loader-message {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, var(--primary-medium) 25%, var(--primary-light) 50%, var(--primary-medium) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* Smooth transitions for cards and buttons */
.card, .btn, li {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Mobile toast positioning */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}

