/* ========================================
   Cuberine CRM - Admin Styles
   Based on Cuberine brand guidelines
   ======================================== */

:root {
    --green-dark: #3D7068;
    --green-light: #7BB989;
    --green-bg: #E8F3F1;
    --beige-light: #F5EDE4;
    --beige-dark: #E8DCC8;
    --text: #333;
    --text-light: #555;
    --text-muted: #888;
    --border: #ddd;
    --danger: #dc3545;
    --warning: #f0ad4e;
    --success: #28a745;
    --white: #fff;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--beige-light);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================================
   Layout
   ======================================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--green-dark);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

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

.sidebar-logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--white);
}

.sidebar-nav { padding: 15px 0; }

.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    text-decoration: none;
}

.nav-item.active { border-left: 3px solid var(--green-light); }

.nav-divider {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 10px 0;
}

.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 20px 30px;
}

/* ========================================
   Header Bar
   ======================================== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 24px;
    color: var(--green-dark);
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name { color: var(--text-light); }

/* ========================================
   Cards & Panels
   ======================================== */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--green-dark);
}

.card-body { padding: 20px; }

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: #fafafa;
}

/* ========================================
   Tables
   ======================================== */
.table-wrapper { overflow-x: auto; }

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

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

th {
    background: var(--green-bg);
    color: var(--green-dark);
    font-weight: 600;
    white-space: nowrap;
}

tr:hover { background: #fafafa; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}

.btn:hover { text-decoration: none; }

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

.btn-secondary {
    background: var(--white);
    color: var(--green-dark);
    border: 1px solid var(--green-dark);
}
.btn-secondary:hover { background: var(--green-bg); }

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

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

.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

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

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

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

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

.form-control:focus {
    outline: none;
    border-color: var(--green-light);
    box-shadow: 0 0 0 3px rgba(123, 185, 137, 0.15);
}

.form-control.error { border-color: var(--danger); }

select.form-control { cursor: pointer; }

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

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

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

.required::after {
    content: ' *';
    color: var(--danger);
}

/* ========================================
   Flash Messages
   ======================================== */
.flash {
    padding: 12px 18px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   Status Badges
   ======================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-draft { background: #e9ecef; color: #495057; }
.badge-sent { background: #cce5ff; color: #004085; }
.badge-accepted { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-invoiced { background: #d1ecf1; color: #0c5460; }

/* ========================================
   Login Page
   ======================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--beige-light), var(--beige-dark));
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

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

.login-logo h1 {
    font-size: 28px;
    color: var(--green-dark);
}

.login-logo p {
    color: var(--text-muted);
    margin-top: 5px;
}

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

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--green-dark);
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 5px;
}

/* ========================================
   Quote Specific
   ======================================== */
.quote-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 25px;
}

.quote-totals {
    background: var(--green-bg);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.quote-totals table { width: auto; margin-left: auto; }
.quote-totals td { padding: 6px 15px; border: none; }
.quote-totals .total-row { font-weight: 700; font-size: 18px; color: var(--green-dark); }

.line-actions { white-space: nowrap; }

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .sidebar, .header-bar, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { background: white; }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    .quote-header { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
