/* ==========================================================================
   VISIT - System Design System (CSS)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
    --bg-main: #0b1120;
    --bg-surface: #1e293b;
    --bg-surface-elevated: #28374d;
    --border-color: #334155;
    --border-light: rgba(255, 255, 255, 0.1);
    
    --primary: #38bdf8;
    --primary-dark: #0284c7;
    --accent-green: #10b981;
    --accent-emerald: #059669;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
    
    --sidebar-width: 260px;
    --header-height: 65px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: #080d19;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.brand-tag {
    font-size: 10px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.menu-item a:hover {
    background-color: var(--bg-surface);
    color: var(--text-main);
}

.menu-item a.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(2, 132, 199, 0.1) 100%);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.menu-item a .icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}

/* Main Content Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header Navbar */
.top-header {
    height: var(--header-height);
    background: rgba(11, 17, 32, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    cursor: pointer;
}

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Main Content Area */
.content-area {
    padding: 28px;
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Views Management */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.45);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-emerald) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.btn-whatsapp {
    background: #25d366;
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
    background: #20bd5a;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
}

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

.btn-outline:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

/* Cards & Glassmorphism */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

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

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

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

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue { background: rgba(56, 189, 248, 0.15); color: var(--primary); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }

.stat-info h4 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.stat-info span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-agendado { background: rgba(56, 189, 248, 0.15); color: var(--primary); border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-em_andamento { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-concluido { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-cancelado { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Form Controls */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-control, .form-select, textarea.form-control {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus, .form-select:focus, textarea.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

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

/* Service List Cards */
.services-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.service-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: all 0.2s ease;
}

.service-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.service-info {
    flex: 1;
}

.service-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.service-detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.service-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Photo Gallery & Upload Dropzone */
.photo-upload-box {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    background: rgba(11, 17, 32, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.photo-upload-box:hover {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.05);
}

.photo-upload-icon {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--primary);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.photo-thumb-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
}

.photo-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-thumb-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}

/* Canvas Signature Area */
.signature-box {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    height: 180px;
    position: relative;
    margin-bottom: 10px;
    touch-action: none;
}

.signature-box canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.signature-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Printable PDF OS Layout */
.os-preview {
    background: #ffffff;
    color: #000000;
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    font-size: 13px;
    line-height: 1.4;
}

.os-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #000;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.os-header h2 {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
}

.os-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.os-table th, .os-table td {
    border: 1px solid #000;
    padding: 8px 12px;
}

.os-table th {
    background: #f1f5f9;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
}

.os-photos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.os-photo-item img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border: 1px solid #000;
    border-radius: 4px;
}

.os-signature-img {
    max-height: 80px;
    border-bottom: 1px solid #000;
    display: block;
    margin-bottom: 4px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .service-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .service-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
    }
}

/* Print CSS Rules */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }
    
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .sidebar, .top-header, .btn, .no-print {
        display: none !important;
    }
    
    .main-wrapper {
        margin-left: 0 !important;
    }
    
    .content-area {
        padding: 0 !important;
    }
    
    .os-preview {
        box-shadow: none !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
}

/* Login Screen Overlay & Card */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 17, 32, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 14px auto;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.35);
}

.login-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}
