/**
 * BG Technologies Equipment Tracker
 * Professional Corporate Design
 */

/* CSS Variables */
:root {
    --color-primary: #3B82F6;
    --color-primary-dark: #2563EB;
    --color-primary-light: #60A5FA;
    --color-navy: #0F172A;
    --color-navy-light: #1E293B;
    --color-slate: #334155;
    --color-slate-light: #475569;
    --color-gray: #64748B;
    --color-gray-light: #94A3B8;
    --color-border: #E2E8F0;
    --color-bg: #F8FAFC;
    --color-white: #FFFFFF;
    --color-success: #10B981;
    --color-success-bg: #D1FAE5;
    --color-warning: #F59E0B;
    --color-warning-bg: #FEF3C7;
    --color-error: #EF4444;
    --color-error-bg: #FEE2E2;
    --color-info: #3B82F6;
    --color-info-bg: #DBEAFE;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-navy);
    background-color: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--color-primary-dark);
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: var(--color-navy);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    max-width: 1280px;
    margin: 0 auto;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-white);
    font-weight: 600;
    font-size: 18px;
}

.nav-brand:hover {
    color: var(--color-white);
}

.brand-icon {
    background: var(--color-primary);
    color: var(--color-white);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.nav-links a {
    color: var(--color-gray-light);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-white);
    background: var(--color-navy-light);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--color-white);
    padding-left: 24px;
    border-left: 1px solid var(--color-slate);
}

.user-name {
    font-weight: 500;
}

.user-role {
    font-size: 12px;
    color: var(--color-gray-light);
    margin-left: -8px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--color-white);
    border-radius: 2px;
    transition: var(--transition);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px 0;
}

/* Cards */
.card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--color-navy);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-navy);
    margin: 0 0 8px 0;
}

.page-header p {
    color: var(--color-gray);
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

.btn-primary:hover {
    background: var(--color-primary-dark);
    color: var(--color-white);
}

.btn-secondary {
    background: var(--color-slate);
    color: var(--color-white);
}

.btn-secondary:hover {
    background: var(--color-navy);
    color: var(--color-white);
}

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

.btn-success:hover {
    background: #059669;
    color: var(--color-white);
}

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

.btn-danger:hover {
    background: #DC2626;
    color: var(--color-white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-slate);
}

.btn-outline:hover {
    background: var(--color-bg);
    color: var(--color-navy);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--color-navy);
}

.form-label .required {
    color: var(--color-error);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-white);
    color: var(--color-navy);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--color-gray-light);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: 12px;
    color: var(--color-gray);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--color-error);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    color: var(--color-slate);
    background: var(--color-bg);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: var(--color-bg);
}

.table-actions {
    display: flex;
    gap: 8px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

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

.stat-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card-icon.blue {
    background: var(--color-info-bg);
    color: var(--color-primary);
}

.stat-card-icon.green {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.stat-card-icon.yellow {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.stat-card-icon.purple {
    background: #EDE9FE;
    color: #8B5CF6;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-navy);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--color-gray);
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.alert-success {
    background: var(--color-success-bg);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-error {
    background: var(--color-error-bg);
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-warning {
    background: var(--color-warning-bg);
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-info {
    background: var(--color-info-bg);
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.alert-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    color: inherit;
}

.alert-close:hover {
    opacity: 1;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -32px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-white);
    border: 2px solid var(--color-primary);
    z-index: 1;
}

.timeline-item:first-child .timeline-marker {
    background: var(--color-primary);
}

.timeline-content {
    background: var(--color-bg);
    padding: 16px;
    border-radius: var(--radius);
}

.timeline-title {
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 4px;
}

.timeline-date {
    font-size: 12px;
    color: var(--color-gray);
    margin-bottom: 8px;
}

.timeline-text {
    font-size: 13px;
    color: var(--color-slate);
    margin: 0;
}

.timeline-user {
    font-size: 12px;
    color: var(--color-gray);
    margin-top: 8px;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-slate) 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: var(--color-navy);
    padding: 32px;
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-white);
}

.login-title {
    color: var(--color-white);
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.login-subtitle {
    color: var(--color-gray-light);
    font-size: 14px;
    margin-top: 8px;
}

.login-body {
    padding: 32px;
}

.login-body .form-group {
    margin-bottom: 24px;
}

.login-body .btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-gray);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--color-slate);
    margin: 0 0 8px 0;
}

.empty-state p {
    margin: 0 0 24px 0;
}

/* Detail View */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.detail-section {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.detail-section-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    color: var(--color-navy);
}

.detail-section-body {
    padding: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--color-gray);
    font-size: 13px;
}

.detail-value {
    font-weight: 500;
    color: var(--color-navy);
    text-align: right;
}

/* Footer */
.footer {
    background: var(--color-navy);
    color: var(--color-gray-light);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    margin-top: auto;
}

.footer p {
    margin: 4px 0;
}

.footer-version {
    opacity: 0.7;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-gray); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-error); }
.text-warning { color: var(--color-warning); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--color-navy);
        flex-direction: column;
        padding: 16px;
        gap: 16px;
        display: none;
        border-top: 1px solid var(--color-slate);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 12px 16px;
    }

    .nav-user {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-left: 0;
        border-left: none;
        padding-top: 16px;
        border-top: 1px solid var(--color-slate);
        width: 100%;
    }

    .page-header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .btn-group {
        flex-direction: column;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .main-content {
        padding: 20px 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .card-header {
        padding: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .login-body {
        padding: 24px;
    }
}

/* Order Styles */
.order-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.order-total {
    font-size: 16px;
    color: var(--color-navy);
}

.total-row td {
    background: var(--color-bg) !important;
    border-top: 2px solid var(--color-border);
}

.total-row td strong {
    font-size: 15px;
}

/* Invoice Badge */
.invoice-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-success-bg);
    color: var(--color-success);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
}

/* Clickable stat cards */
.stat-card[style*="cursor: pointer"]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .nav-toggle {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--color-border);
    }
}
