:root {
    --primary-color: #be185d;
    /* Pink 700 */
    --primary-light: #fce7f3;
    /* Pink 100 */
    --accent-color: #831843;
    /* Pink 900 */
    --background: #f8fafc;
    /* Slate 50 */
    --surface: #ffffff;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --radius-md: 12px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    /* Mobile first logic limited width on desktop */
    margin: 0 auto;
    background: var(--surface);
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Header */
.app-header {
    background: var(--surface);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.header-left h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.date-selector button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
}

/* Fila da Vez */
.fila-vez-header {
    display: flex;
    gap: 8px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.vez-badge {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.vez-badge strong {
    color: var(--primary-color);
}

.vez-badge .rotate-btn {
    border: none;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    font-size: 0.8rem;
    margin-left: 2px;
}

.vez-badge .rotate-btn:hover {
    color: var(--primary-color);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* Filter Bar */
.filter-bar {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.filter-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-family: inherit;
    background-color: var(--background);
}

/* Main Content */
#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px));
    /* Extra space for nav/fab + safe area */
    background: var(--background);
    scrollbar-width: none;
    /* Firefox */
}

#main-content::-webkit-scrollbar {
    display: none;
}

/* Chrome */

.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Timeline base styles */
.timeline {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Login Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex;
}

.login-box {
    width: 90%;
    max-width: 320px;
    padding: 2rem;
    background: var(--glass-bg);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.logo-area h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    line-height: 1;
}

.logo-area .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

#login-form {
    margin-top: 2rem;
    text-align: left;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    resize: vertical;
}

/* Checkbox specific styles */
.input-group input[type="checkbox"] {
    width: auto;
    padding: 0;
    margin: 0;
    margin-right: 8px;
    cursor: pointer;
}

.input-group label:has(input[type="checkbox"]) {
    display: inline-flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
}

.input-group select {
    max-height: 200px;
    overflow-y: auto;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(190, 24, 93, 0.3);
    transition: transform 0.1s;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    display: block;
    width: 100%;
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* Timeline Items */
.timeline-item {
    background: var(--surface);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.timeline-item.blocked {
    border-left-color: var(--text-muted);
    opacity: 0.8;
    background: #f3f4f6;
}

.timeline-item.concluded {
    border-left-color: var(--success);
}

.timeline-item.cancelled {
    border-left-color: var(--danger);
    opacity: 0.6;
}

.t-time {
    font-weight: 700;
    color: var(--text-main);
    width: 50px;
}

.t-details h4 {
    font-weight: 600;
    font-size: 1rem;
}

.t-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.t-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eee;
    margin-top: 4px;
    display: inline-block;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    background: var(--surface);
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    flex: 1;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
}

.nav-item.active {
    color: var(--primary-color);
}

/* FAB */
.fab {
    position: fixed;
    bottom: 95px;
    right: calc(50% - 280px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(190, 24, 93, 0.4);
    cursor: pointer;
    z-index: 20;
    transition: transform 0.2s;
}

@media (max-width: 600px) {
    .fab {
        right: 20px;
    }
}

.fab:active {
    transform: scale(0.9);
}

.quick-block-fab {
    position: fixed;
    bottom: 165px;
    right: calc(50% - 272px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--text-muted);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 20;
}

@media (max-width: 600px) {
    .quick-block-fab {
        right: 28px;
    }
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Utilities */
.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    /* Bottom sheet on mobile */
}

@media(min-width: 600px) {
    .modal-overlay {
        align-items: center;
        justify-content: center;
    }
}

.modal-content {
    width: 100%;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
}

@media(min-width: 600px) {
    .modal-content {
        max-width: 400px;
        border-radius: 20px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

#close-modal {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Agenda Action Buttons */
.t-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-action {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-action:active {
    transform: scale(0.96);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-confirm {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Blue 100/800 */
.btn-confirm:hover {
    background-color: #bfdbfe;
}

.btn-reschedule {
    background-color: #fef3c7;
    color: #92400e;
}

/* Amber 100/800 */
.btn-reschedule:hover {
    background-color: #fde68a;
}

.btn-falta {
    background-color: #f3f4f6;
    color: #374151;
}

/* Gray 100/700 */
.btn-falta:hover {
    background-color: #e5e7eb;
}

.btn-cancel {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Red 100/800 */
.btn-cancel:hover {
    background-color: #fecaca;
}

/* Professional Management Buttons */
.prof-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.btn-edit {
    background-color: #3b82f6;
    color: white;
}

.btn-edit:hover {
    background-color: #2563eb;
}

.btn-delete {
    background-color: #ef4444;
    color: white;
}

.btn-delete:hover {
    background-color: #dc2626;
}

.btn-vacation {
    background-color: #10b981;
    color: white;
}

.btn-vacation:hover {
    background-color: #059669;
}

/* ============================================
   RESPONSIVE DESKTOP & TABLET STYLES
   ============================================ */

/* Tablet Portrait (768px - 1023px) */
@media (min-width: 768px) {

    /* Remove mobile constraints */
    .app-container {
        max-width: 100%;
        box-shadow: none;
    }

    /* Header improvements */
    .app-header {
        padding: 1rem 2rem;
    }

    .header-left h2 {
        font-size: 1.5rem;
    }

    /* Main content with better padding */
    #main-content {
        padding: 1.5rem 2rem;
        padding-bottom: 120px;
    }

    /* Timeline grid for agenda */
    .timeline {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .timeline-item {
        margin-bottom: 0;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* List grids for tablet */
    #inventory-list,
    #services-list,
    #clients-list,
    #team-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 1rem;
    }

    .stat-card {
        margin-bottom: 0;
    }

    /* Modal centered */
    .modal-overlay {
        align-items: center;
        justify-content: center;
    }

    .modal-content {
        width: 90%;
        max-width: 500px;
        border-radius: 20px;
        max-height: 85vh;
    }

    /* FAB positioning */
    .fab {
        bottom: 100px;
        right: 30px;
    }

    .quick-block-fab {
        bottom: 170px;
        right: 38px;
    }

    /* Bottom nav stays but larger */
    .bottom-nav {
        max-width: 100%;
        padding: 0.75rem 2rem;
    }

    .nav-item {
        padding: 0.75rem 1rem;
    }

    .nav-item i {
        font-size: 1.4rem;
    }

    .nav-item span {
        font-size: 0.8rem;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    body {
        overflow: auto;
    }

    .app-container {
        max-width: 100%;
        height: auto;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        background: var(--background);
    }

    /* Convert bottom-nav to sidebar */
    .bottom-nav {
        position: fixed;
        left: 0;
        right: auto;
        top: 0;
        bottom: 0;
        width: 240px;
        max-width: 240px;
        margin: 0;
        flex-direction: column;
        justify-content: flex-start;
        padding: 2rem 1rem;
        padding-top: 100px;
        border-top: none;
        border-right: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
        background: linear-gradient(180deg, var(--surface) 0%, #fdf2f8 100%);
        z-index: 100;
        gap: 0.5rem;
    }

    .nav-item {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 1rem 1.25rem;
        border-radius: var(--radius-md);
        transition: all 0.2s ease;
    }

    .nav-item:hover {
        background: var(--primary-light);
        transform: translateX(4px);
    }

    .nav-item.active {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
        color: white;
        box-shadow: 0 4px 12px rgba(190, 24, 93, 0.3);
    }

    .nav-item i {
        font-size: 1.25rem;
        width: 24px;
        text-align: center;
    }

    .nav-item span {
        font-size: 0.95rem;
        font-weight: 500;
    }

    /* Header adjustments */
    .app-header {
        position: fixed;
        top: 0;
        left: 240px;
        right: 0;
        z-index: 50;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 1rem 2rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .header-left h2 {
        font-size: 1.75rem;
    }

    /* Main content */
    #main-content {
        margin-left: 240px;
        margin-top: 80px;
        width: calc(100% - 240px);
        padding: 2rem 3rem;
        padding-bottom: 3rem;
        min-height: calc(100vh - 80px);
        overflow-y: visible;
    }

    /* Timeline 3 columns on large desktop */
    .timeline {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
        width: 100%;
    }

    /* View sections full width */
    .view-section {
        width: 100%;
    }

    #view-agenda {
        width: 100%;
    }

    /* Enhanced timeline items */
    .timeline-item {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
        transition: all 0.2s ease;
        border-left-width: 5px;
    }

    .timeline-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    }

    /* Stats grid 4 columns */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .stat-card {
        padding: 2rem;
        border-radius: var(--radius-lg);
        transition: transform 0.2s ease;
    }

    .stat-card:hover {
        transform: translateY(-3px);
    }

    .stat-card .value {
        font-size: 2rem;
    }

    /* Filter bar */
    .filter-bar {
        margin-left: 240px;
        width: calc(100% - 240px);
        padding: 0.75rem 2rem;
    }

    .filter-select {
        max-width: 300px;
    }

    /* Modal improvements */
    .modal-content {
        max-width: 600px;
        padding: 2rem;
    }

    .modal-header h3 {
        font-size: 1.5rem;
    }

    /* FAB positioning for desktop */
    .fab {
        right: 40px;
        bottom: 40px;
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }

    .quick-block-fab {
        right: 52px;
        bottom: 120px;
        width: 48px;
        height: 48px;
    }

    /* Login overlay adjustments */
    .login-box {
        max-width: 400px;
        padding: 2.5rem;
    }

    .logo-area h1 {
        font-size: 3rem;
    }

    /* Fila da vez */
    .fila-vez-header {
        margin-bottom: 1.5rem;
    }

    .vez-badge {
        padding: 4px 12px;
        font-size: 0.8rem;
    }

    /* Cards list for services/clients */
    .card-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 1.5rem;
    }

    /* Team list grid */
    #team-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
        gap: 1.5rem;
    }

    /* Inventory list grid */
    #inventory-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1rem;
    }

    /* Services list grid */
    #services-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 1.5rem;
    }

    /* Clients list grid */
    #clients-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 1.5rem;
    }
}

/* Extra Large Desktop (1440px+) */
@media (min-width: 1440px) {
    .timeline {
        grid-template-columns: repeat(4, 1fr);
    }

    #main-content {
        padding: 2rem 4rem;
    }

    .stats-grid {
        gap: 2rem;
    }

    .card-list,
    #team-list,
    #services-list,
    #clients-list {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
}

/* Sidebar Logo - Desktop Only */
@media (min-width: 1024px) {
    .bottom-nav::before {
        content: 'Kess';
        display: block;
        position: absolute;
        top: 24px;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 2rem;
        font-weight: 700;
        color: var(--primary-color);
        letter-spacing: -1px;
    }

    .bottom-nav::after {
        content: 'Beleza & Gestão';
        display: block;
        position: absolute;
        top: 58px;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 0.7rem;
        color: var(--text-muted);
        letter-spacing: 1px;
        text-transform: uppercase;
    }
}

/* Smooth transitions for responsive changes */
.app-container,
.bottom-nav,
.nav-item,
#main-content,
.timeline-item,
.modal-content,
.fab {
    transition: all 0.3s ease;
}

/* Print styles - hide navigation */
@media print {

    .bottom-nav,
    .fab,
    .quick-block-fab,
    .app-header {
        display: none !important;
    }

    #main-content {
        margin: 0 !important;
        padding: 1rem !important;
    }
}