:root {
    --primary: #667eea;
    --primary-600: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --font-primary: 'Poppins', sans-serif;
    --font-secondary: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    color: var(--gray-800);
    background: var(--gray-50);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.sidebar {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-600) 100%);
    color: white;
    width: 250px;
    height: 100vh;
    padding: 30px 0;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.sidebar-logo {
    padding: 0 20px;
    margin-bottom: 40px;
    text-align: center;
}

.sidebar-logo-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu-item {
    padding: 15px 20px;
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left-color: rgba(255, 255, 255, 0);
}

.sidebar-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.sidebar-menu-item.active {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: white;
    font-weight: 600;
}

.sidebar-menu-item a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu-item-icon {
    font-size: 18px;
    min-width: 24px;
}

.main-content {
    margin-left: 250px;
    padding: 30px 20px;
    min-height: 100vh;
}

/* Header */
.header {
    background: white;
    padding: 20px 0;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--gray-100);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-menu:hover {
    background: var(--gray-200);
}

.user-menu-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

/* Cards */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    color: var(--gray-700);
    line-height: 1.6;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-sm:has-text {
    padding: 6px 12px;
}

.btn:not(:has-text) {
    padding: 8px 10px;
    min-width: 40px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-900);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-2px);
}

/* Icon-only buttons */
.btn.icon-only {
    padding: 8px 10px;
    min-width: 40px;
    justify-content: center;
    gap: 0;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-900);
    font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-secondary);
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group.inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* List Styles */
.list {
    list-style: none;
}

.list-item {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.list-item:hover {
    background: var(--gray-50);
}

.list-item:last-child {
    border-bottom: none;
}

/* Form Group Inline */
.form-group.inline {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group.inline > div {
    flex: 1;
    min-width: 150px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
    color: white;
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

.table tr:hover {
    background: var(--gray-50);
}

/* Status Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Progress Bar */
.progress {
    width: 100%;
    height: 12px;
    background: var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.progress-bar {
    height: 100%;
    /* background: linear-gradient(90deg, var(--success) 0%, var(--success) 100%); */
    /* Cor definida dinamicamente via JavaScript e PHP inline */
    width: 0%;
    transition: width 0.5s ease, background-color 0.3s ease;
    border-radius: 10px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--info);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Stat Card */
.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateY(-4px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

/* Timer Display */
.timer-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    border: 2px solid var(--border);
    margin-bottom: 15px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.timer-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--success);
}

.timer-card.warning::before {
    background: var(--warning);
}

.timer-card.danger::before {
    background: var(--danger);
}

.timer-card.completed::before {
    background: var(--danger);
    width: 6px;
}

.timer-card.completed {
    border-color: var(--danger);
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.timer-card.paid-session {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.timer-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.timer-paid {
    font-size: 14px;
    font-weight: 600;
}

.timer-paid.yes {
    color: var(--success);
}

.timer-paid.no {
    color: var(--danger);
}

.timer-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gray-500);
}

.timer-status-icon {
    font-size: 16px;
}

.timer-time {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
}

.timer-progress {
    margin-bottom: 15px;
}

.timer-actions {
    display: flex;
    gap: 10px;
}

.timer-action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
}

.timer-action-pay {
    background: var(--success);
    color: white;
}

.timer-action-pay:hover {
    background: #059669;
}

.timer-action-pay.paid-button {
    background: var(--success);
    opacity: 0.7;
    cursor: not-allowed;
}

.timer-action-pay.paid-button:hover {
    background: var(--success);
    opacity: 0.7;
}

.timer-action-pay.paid {
    background: #059669;
}

.timer-action-stop {
    background: var(--danger);
    color: white;
}

.timer-action-stop:hover {
    background: #dc2626;
}

.timer-action-remove {
    background: #f59e0b;
    color: white;
}

.timer-action-remove:hover {
    background: #d97706;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse-completed {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.alert.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 20px;
        display: none;
    }

    .sidebar.mobile-open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 20px 15px;
    }

    .header-title {
        font-size: 24px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .form-group.inline {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .timer-card {
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .header-title {
        font-size: 20px;
    }

    .card {
        padding: 15px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .stat-value {
        font-size: 24px;
    }

    .timer-time {
        font-size: 28px;
    }

    .modal-body {
        padding: 15px;
    }
}

/* Customer Search */
#customerSearch {
    background: white !important;
    border: 2px solid var(--border) !important;
    padding: 12px 15px !important;
    border-radius: 8px !important;
    font-size: 14px;
    transition: all 0.3s ease;
}

#customerSearch:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#customerSearch::placeholder {
    color: #999;
}

/* Timer Card Enhancements */
.timer-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
}

.timer-time {
    font-size: 42px;
    font-weight: 800;
    text-align: center;
    color: var(--primary);
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.timer-card.warning .timer-time {
    color: var(--warning);
}

.timer-card.completed .timer-time {
    color: var(--danger);
    text-decoration: line-through;
    opacity: 0.6;
}

/* List View Styling */
.list-view {
    display: flex !important;
    flex-direction: column;
}

.list-view .timer-card {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 0;
    padding: 12px 15px;
}

.list-view .timer-header {
    min-width: 200px;
    flex-shrink: 0;
}

.list-view .timer-time {
    font-size: 24px;
    margin: 0;
    min-width: 100px;
    text-align: center;
    flex-shrink: 0;
}

.list-view .timer-progress {
    margin: 0;
    min-width: 150px;
    flex-shrink: 0;
}

.list-view .timer-progress .progress {
    margin: 0;
    height: 8px;
}

.list-view .timer-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.list-view .timer-action-btn {
    padding: 6px 10px;
    font-size: 12px;
    flex: 0 1 auto;
}
