/* style.css - SpeedNet Internet Accounting & Billing System */
:root {
    --primary-orange: #d84315;
    --dark-orange: #bf360c;
    --gold-accent: #f57f17;
    --gold-light: #fff8e1;
    --dark-bg: #1c1917;
    --window-bg: #f8f9fa;
    --border-color: #d6d3d1;
    --text-main: #1f2937;
    --btn-gold: linear-gradient(180deg, #d84315 0%, #b71c1c 100%);
    --btn-amber: linear-gradient(180deg, #ff8f00 0%, #d84315 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f1f5f9;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Top Bar */
.app-header {
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.top-title-bar {
    background: linear-gradient(90deg, #fff3e0 0%, #ffe0b2 50%, #fff3e0 100%);
    padding: 10px 15px;
    text-align: center;
    border-bottom: 1px solid #ffe0b2;
}

.top-title-bar h1 {
    font-family: 'Times New Roman', Times, serif;
    color: #b71c1c;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 1px 1px 0px #fff;
}

.top-menu-bar {
    background: #424242;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.menu-items {
    display: flex;
    list-style: none;
}

.menu-items li a {
    color: #ffffff;
    text-decoration: none;
    padding: 10px 18px;
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: background 0.2s;
}

.menu-items li a:hover,
.menu-items li a.active {
    background: var(--primary-orange);
}

/* User profile tag on right of menu bar */
.user-tag {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffecb3;
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-tag a {
    color: #ff8a80;
    text-decoration: none;
    font-weight: bold;
}
.user-tag a:hover {
    text-decoration: underline;
}

/* Mobile Toggle Hamburger */
.mobile-nav-toggle {
    display: none;
    background: var(--primary-orange);
    color: white;
    border: none;
    padding: 8px 14px;
    font-size: 1.2rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Main Layout Wrapper */
.app-container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 90px);
    position: relative;
}

/* Left Sidebar Menu (Matching Desktop Screenshot) */
.app-sidebar {
    width: 260px;
    background: #1e1e1e;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 1px solid #333;
    transition: transform 0.3s ease;
}

.sidebar-btn {
    background: linear-gradient(90deg, #bf360c 0%, #d84315 100%);
    color: #ffffff;
    border: 1px solid #8c2703;
    padding: 10px 12px;
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 3px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.3);
    display: block;
    text-align: left;
    transition: transform 0.1s, filter 0.2s;
    cursor: pointer;
}

.sidebar-btn:hover {
    filter: brightness(1.15);
    color: #fff8e1;
}

.sidebar-btn.active {
    background: linear-gradient(90deg, #ff6f00 0%, #ff8f00 100%);
    color: #ffffff;
    border-color: #e65100;
}

/* Main Content Area */
.app-content {
    flex: 1;
    padding: 20px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffecb3 25%, #ffffff 100%);
    overflow-y: auto;
}

/* Master Form Window Box (Matching Desktop Dialog Look) */
.master-window {
    background: #ffffff;
    border: 2px solid #b71c1c;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-width: 900px;
    margin: 0 auto 30px auto;
    overflow: hidden;
}

.master-window-header {
    background: linear-gradient(180deg, #d84315 0%, #b71c1c 100%);
    color: #ffffff;
    padding: 10px 16px;
    font-weight: bold;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.master-window-body {
    padding: 20px;
    background: #fafafa;
}

/* Form Fields Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
}

.form-group label .required {
    color: #d32f2f;
}

.form-control {
    padding: 7px 10px;
    border: 1px solid #9e9e9e;
    border-radius: 3px;
    font-size: 0.9rem;
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #d84315;
    box-shadow: 0 0 0 2px rgba(216, 67, 21, 0.2);
}

/* Action Button Toolbar */
.btn-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.btn-custom {
    padding: 7px 18px;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid #616161;
    background: #e0e0e0;
    color: #212121;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.15s ease-in-out;
}

.btn-custom:hover {
    filter: brightness(0.92);
}

.btn-save {
    background: linear-gradient(180deg, #2e7d32 0%, #1b5e20 100%);
    color: #ffffff;
    border-color: #1b5e20;
}

.btn-update {
    background: linear-gradient(180deg, #0277bd 0%, #01579b 100%);
    color: #ffffff;
    border-color: #01579b;
}

.btn-delete {
    background: linear-gradient(180deg, #c62828 0%, #8e0000 100%);
    color: #ffffff;
    border-color: #8e0000;
}

.btn-gold {
    background: linear-gradient(180deg, #d84315 0%, #b71c1c 100%);
    color: #ffffff;
    border-color: #8e0000;
}

.btn-amber {
    background: linear-gradient(180deg, #ff8f00 0%, #e65100 100%);
    color: #ffffff;
    border-color: #bf360c;
}

/* Data Table Grid */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
    background: #ffffff;
    border: 1px solid #cccccc;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: #424242;
    color: #ffffff;
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.78rem;
    border: 1px solid #333333;
    white-space: nowrap;
}

.data-table td {
    padding: 7px 10px;
    border: 1px solid #e0e0e0;
    color: #212121;
}

.data-table tr:nth-child(even) {
    background-color: #f5f5f5;
}

.data-table tr:hover {
    background-color: #ffe0b2;
}

/* Summary Box Styling */
.summary-card {
    background: #fff8e1;
    border: 1px solid #ffe082;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    font-weight: bold;
    color: #b71c1c;
}

/* Login Page Styling */
.login-body {
    background: linear-gradient(135deg, #bf360c 0%, #d84315 50%, #ff8f00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(180deg, #d84315 0%, #b71c1c 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
}

.login-header h2 {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1.6rem;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.login-header p {
    font-size: 0.85rem;
    opacity: 0.9;
}

.login-body-content {
    padding: 30px 25px;
}

.alert-message {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.alert-danger {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Responsive Rules for Mobile & Tablet */
@media (max-width: 991px) {
    /* Top title bar styling on mobile */
    .top-title-bar {
        padding: 8px 10px;
    }
    .top-title-bar h1 {
        font-size: 1.15rem;
        letter-spacing: 0.5px;
    }

    /* Top navigation bar header row on mobile */
    .top-menu-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 12px;
        background: #212121;
    }

    .mobile-header-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    /* Mobile toggle button with 44px min touch target */
    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        background: var(--primary-orange);
        color: #ffffff;
        border: 1px solid #bf360c;
        padding: 8px 16px;
        font-size: 0.95rem;
        font-weight: 700;
        border-radius: 4px;
        min-height: 44px;
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    .mobile-nav-toggle:active {
        background: var(--dark-orange);
    }

    /* Strictly Vertical Top Menu Bar on Mobile */
    .menu-items {
        display: none; /* hidden when collapsed, shown when toggled */
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
        border-top: 1px solid #424242;
        padding-top: 6px;
        list-style: none;
    }

    .menu-items.show {
        display: flex !important;
    }

    .menu-items li {
        width: 100%;
        border-bottom: 1px solid #333333;
    }
    .menu-items li:last-child {
        border-bottom: none;
    }

    .menu-items li a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 12px 16px;
        font-size: 0.95rem;
        font-weight: 700;
        min-height: 44px; /* WCAG touch target */
        color: #ffffff;
        text-decoration: none;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        border-radius: 4px;
    }

    .menu-items li a.active,
    .menu-items li a:hover {
        background: var(--primary-orange);
        color: #ffffff;
    }

    /* User profile tag on mobile */
    .user-tag {
        font-size: 0.85rem;
        padding: 4px 0;
    }

    /* Main Container layout */
    .app-container {
        flex-direction: column;
    }

    /* Sidebar Navigation Menu on Mobile (Vertical List) */
    .app-sidebar {
        width: 100%;
        position: relative;
        transform: none;
        visibility: visible;
        box-shadow: none;
        padding: 10px;
        background: #181818;
        display: none; /* toggled via mobile menu */
    }

    .app-sidebar.show {
        display: flex !important;
    }

    .sidebar-btn {
        width: 100%;
        min-height: 44px;
        padding: 12px 14px;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
    }

    /* Master Window Box for Mobile */
    .master-window {
        max-width: 100%;
        margin: 10px 0 20px 0;
        border-radius: 4px;
    }

    .master-window-header {
        padding: 12px 15px;
        font-size: 1.05rem;
    }

    .master-window-body {
        padding: 14px;
    }

    /* Form Fields Grid - Single Column for Mobile */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .form-group.full-width {
        grid-column: span 1 !important;
    }

    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    /* 16px font-size on mobile inputs prevents auto-zoom on iOS/Android */
    .form-control {
        font-size: 16px !important;
        min-height: 44px;
        padding: 8px 12px;
    }

    /* Select2 Mobile Touch Optimization */
    .select2-container--default .select2-selection--single {
        height: 44px !important;
        padding: 6px 10px;
    }
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 32px !important;
        font-size: 16px !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 42px !important;
    }

    /* Action Buttons Toolbar on Mobile */
    .btn-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .btn-custom {
        width: 100% !important;
        min-height: 44px;
        font-size: 0.9rem !important;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 16px;
    }

    /* Data Tables Mobile Optimization */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        margin-top: 10px;
    }

    .data-table th, .data-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
}
