/* =========================================
   RESET & BASE
   ========================================= */
:root {
    --primary: #2c3e50;
    --primary-light: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-600: #6c757d;
    --gray-900: #212529;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f4f6f9;
    color: #333;
    margin: 0;
    line-height: 1.6;
}
a { text-decoration: none; color: var(--primary-light); }
a:hover { color: #1a6ea8; }
.container { max-width: 1300px; margin: 0 auto; padding: 0 20px; }

/* =========================================
   NAVBAR
   ========================================= */
.navbar {
    background: var(--primary);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.navbar .brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white !important;
    letter-spacing: 0.5px;
}
.navbar .nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}
.navbar .nav-links a {
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    transition: color 0.2s;
}
.navbar .nav-links a:hover { color: white; }

/* =========================================
   DASHBOARD CARDS
   ========================================= */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}
.card {
    background: white;
    padding: 20px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.03);
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.05);
}
.card h3 {
    color: var(--gray-600);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0;
    margin-bottom: 10px;
}
.card p { margin: 5px 0; font-weight: 500; color: var(--gray-900); font-size: 1rem; }
.card .value { font-size: 1.5rem; font-weight: 700; color: var(--primary-light); }
.card .stat-label { color: var(--gray-600); font-weight: 400; font-size: 0.9rem; }

/* =========================================
   TABLES
   ========================================= */
.table-wrapper { background: white; border-radius: var(--border-radius); box-shadow: var(--shadow); overflow: hidden; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 20px; text-align: left; border-bottom: 1px solid var(--gray-200); }
th { background: var(--gray-100); color: var(--gray-600); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; }
tr:hover { background: #fafbfc; }
td { color: var(--gray-900); }

/* =========================================
   STATUS BADGES
   ========================================= */
.status-badge { 
    display: inline-block; 
    padding: 4px 12px; 
    border-radius: 50px; 
    font-size: 0.75rem; 
    font-weight: 600;
    text-transform: capitalize;
}
.status-draft { background: #e2e8f0; color: #4a5568; }
.status-sent { background: #bee3f8; color: #2b6cb0; }
.status-pending { background: #fefcbf; color: #975a16; }
.status-paid { background: #c6f6d5; color: #22543d; }
.status-overdue { background: #fed7d7; color: #9b2c2c; }
.status-active { background: #c6f6d5; color: #22543d; }
.status-disabled { background: #fed7d7; color: #9b2c2c; }
.status-expired { background: #e2e8f0; color: #4a5568; }

/* =========================================
   FORMS & BUTTONS
   ========================================= */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--gray-900); font-size: 0.9rem; }
.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: var(--border-radius);
    font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s; background: white;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--primary-light); outline: none; box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}
textarea { min-height: 80px; resize: vertical; }

.btn {
    display: inline-block; padding: 10px 20px; border: none; border-radius: var(--border-radius);
    font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
    text-align: center;
}
.btn-primary { background: var(--primary-light); color: white; }
.btn-primary:hover { background: #2980b9; transform: translateY(-1px); box-shadow: 0 4px 6px rgba(52, 152, 219, 0.3); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* =========================================
   UTILITIES
   ========================================= */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; border-bottom: 1px solid var(--gray-200); padding-bottom: 15px; }
.page-header h1 { margin: 0; font-size: 1.75rem; color: var(--gray-900); }
.text-center { text-align: center; }
.mt-3 { margin-top: 20px; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .navbar .container { flex-direction: column; gap: 10px; align-items: flex-start; }
    .navbar .nav-links { flex-wrap: wrap; gap: 10px; }
    .dashboard-cards { grid-template-columns: 1fr; }
    th, td { padding: 10px 15px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}


/* =========================================
   RESPONSIVE TABLES (Mobile)
   ========================================= */
@media (max-width: 768px) {
    /* 1. სტანდარტული ცხრილი - გადაადგილება (fallback) */
    .table-wrapper {
        overflow-x: auto;
    }

    /* 2. სუპერ-პროფესიონალური Card View */
    .table-responsive {
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    
    .table-responsive thead {
        display: none; /* სათაურის დამალვა */
    }
    
    .table-responsive tr {
        display: block;
        margin-bottom: 20px;
        background: #ffffff;
        border: 1px solid var(--gray-200);
        border-radius: var(--border-radius);
        padding: 15px;
        box-shadow: var(--shadow);
    }
    
    .table-responsive td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 8px 0;
        border-bottom: 1px solid var(--gray-200);
        font-size: 0.9rem;
    }
    
    .table-responsive td:last-child {
        border-bottom: none;
    }

    /* ველის სახელის ავტომატური ჩასმა data-label-დან */
    .table-responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-600);
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
        margin-right: 15px;
    }
}