/* ================================================
   WABAG Manual Management System - Modern UI
   Bootstrap 5 + Custom Styling
   ================================================ */

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

/* ================================================
   ROOT VARIABLES
   ================================================ */
:root {
    --primary-gradient-start: #1e3c72;
    --primary-gradient-end: #2a5298;
    --accent-color: #4CAF50;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --bg-light: #f8f9fa;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --hover-shadow: 0 4px 16px rgba(0,0,0,0.15);
    --transition-speed: 0.3s;
}

/* ================================================
   GLOBAL STYLES
   ================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ================================================
   LOGIN PAGE STYLES
   ================================================ */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -150px;
    right: -150px;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    bottom: -200px;
    left: -200px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 50px 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 200px;
    height: auto;
    margin-bottom: 15px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-gradient-start);
    text-align: center;
    margin-bottom: 10px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 35px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: block;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all var(--transition-speed);
    font-family: 'Inter', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-gradient-end);
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 60, 114, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.password-notice {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
    margin-top: 20px;
}

/* ================================================
   MAIN LAYOUT - SIDEBAR + TOPBAR
   ================================================ */
.page-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all var(--transition-speed);
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 10px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: white;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    list-style: none;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all var(--transition-speed);
    font-size: 14px;
    font-weight: 500;
}

.menu-link i {
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 30px;
}

.menu-link.active {
    background: var(--accent-color);
    border-left: 4px solid white;
    color: white;
}

/* Dropdown Menu */
.menu-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 25px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all var(--transition-speed);
    font-size: 14px;
    font-weight: 500;
}

.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.dropdown-menu-custom {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed);
    background: rgba(0, 0, 0, 0.2);
}

.menu-dropdown.open .dropdown-menu-custom {
    max-height: 500px;
}

.dropdown-item {
    padding: 10px 25px 10px 57px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: block;
    font-size: 13px;
    transition: all var(--transition-speed);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 60px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 25px;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: all var(--transition-speed);
}

/* Topbar */
.topbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-gradient-start);
    cursor: pointer;
    margin-right: 15px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-gradient-start);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-light);
}

.btn-logout {
    padding: 8px 20px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
    display: inline-block;
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Content Container */
.content-container {
    padding: 30px;
    flex: 1;
}

/* ================================================
   CARDS & COMPONENTS
   ================================================ */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 25px;
    margin-bottom: 20px;
    transition: all var(--transition-speed);
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-light);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-gradient-start);
    margin: 0;
}

.card-body {
    color: var(--text-dark);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-icon.blue {
    background: rgba(30, 60, 114, 0.1);
    color: var(--primary-gradient-start);
}

.stat-icon.green {
    background: rgba(76, 175, 80, 0.1);
    color: var(--accent-color);
}

.stat-icon.orange {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.stat-icon.red {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: none;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.3);
}

.btn-success {
    background: var(--accent-color);
    color: white;
}

.btn-success:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* ================================================
   TABLES
   ================================================ */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

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

thead {
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

tr:hover {
    background: var(--bg-light);
}

/* ================================================
   LOADING SPINNER
   ================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.spinner {
    border: 4px solid rgba(30, 60, 114, 0.1);
    border-top: 4px solid var(--primary-gradient-start);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .login-container {
        padding: 30px 20px;
    }
    
    .content-container {
        padding: 15px;
    }
    
    .topbar {
        padding: 12px 15px;
    }
    
    .page-title {
        font-size: 18px;
    }
}

/* ================================================
   UTILITY CLASSES
   ================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }
