/* ==========================================
   FORANS Warehouse AI — Dark Premium Theme
   ========================================== */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-glass: rgba(30, 41, 59, 0.85);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-green: #22c55e;
    --accent-green-glow: rgba(34, 197, 94, 0.25);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.25);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.25);
    --accent-orange: #f59e0b;
    --accent-orange-glow: rgba(245, 158, 11, 0.25);
    --accent-gray: #64748b;
    --accent-gray-glow: rgba(100, 116, 139, 0.2);
    --accent-purple: #a855f7;
    --border: #334155;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== Screens ========== */

.screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 16px;
    padding-bottom: 90px;
    animation: fadeIn 0.25s ease;
}

.screen.active {
    display: block;
}

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

/* ========== Loading Screen ========== */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    gap: 12px;
}

.loading-logo {
    font-size: 72px;
    animation: pulse 2s infinite;
}

.loading-title {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.loading-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-top: 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* ========== Header ========== */

.header {
    padding: 8px 0 16px;
}

.app-title {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 4px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-name {
    font-size: 20px;
    font-weight: 700;
}

.user-date {
    color: var(--text-secondary);
    font-size: 14px;
}

.user-total {
    color: var(--accent-blue);
    font-size: 14px;
    margin-top: 4px;
    font-weight: 500;
}

/* ========== Search ========== */

.search-container {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ========== Cards Grid ========== */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 90px;
    justify-content: center;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.card:active {
    transform: scale(0.96);
}

.card-icon {
    font-size: 32px;
    line-height: 1;
}

.card-name {
    font-size: 14px;
    font-weight: 600;
    word-break: break-word;
    line-height: 1.3;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Category cards */
.categories-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.card-category {
    min-height: 120px;
    padding: 24px 16px;
    border: 2px solid var(--border);
}

.card-category .card-icon {
    font-size: 42px;
}

.card-category .card-name {
    font-size: 15px;
    word-break: keep-all;
    overflow-wrap: normal;
}

.card-category:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.15);
}

/* ========== Buttons ========== */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-icon {
    font-size: 22px;
}

.btn-start {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    box-shadow: 0 4px 16px var(--accent-green-glow);
}

.btn-start:hover {
    box-shadow: 0 6px 24px var(--accent-green-glow);
    transform: translateY(-1px);
}

.btn-finish, .btn-finish-lg {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    box-shadow: 0 4px 16px var(--accent-blue-glow);
}

.btn-finish:hover, .btn-finish-lg:hover {
    box-shadow: 0 6px 24px var(--accent-blue-glow);
    transform: translateY(-1px);
}

.btn-cancel, .btn-cancel-lg {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-cancel:hover, .btn-cancel-lg:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    box-shadow: 0 4px 16px var(--accent-red-glow);
}

.btn-info {
    background: var(--bg-secondary);
    color: var(--accent-blue);
    border: 1px solid var(--border);
}

.btn-info:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
}

.btn-confirm {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    box-shadow: 0 4px 16px var(--accent-green-glow);
}

.btn-go-back {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-back {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 8px;
}

/* ========== Dashboard ========== */

.dashboard-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 20px;
}

.active-bar {
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: glowPulse 3s ease-in-out infinite;
}

.active-bar-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.active-op-name {
    font-weight: 600;
    font-size: 15px;
}

.active-op-client {
    color: var(--text-secondary);
    font-size: 13px;
}

.active-timer {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent-blue);
    font-variant-numeric: tabular-nums;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(59, 130, 246, 0.1); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); }
}

/* ========== Timer Screen ========== */

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    gap: 20px;
    padding: 20px;
}

.timer-status {
    font-size: 18px;
    color: var(--accent-blue);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

.timer-display {
    font-size: 64px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.timer-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}

.timer-detail {
    font-size: 16px;
    color: var(--text-secondary);
}

.timer-actions {
    display: flex;
    gap: 14px;
    width: 100%;
    max-width: 400px;
    margin-top: 16px;
}

.timer-actions .btn {
    flex: 1;
    padding: 16px;
    font-size: 14px;
}

/* ========== Dialogs ========== */

.dialog-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    gap: 16px;
    padding: 24px;
    text-align: center;
}

.dialog-icon {
    font-size: 64px;
    margin-bottom: 8px;
}

.dialog-container h2 {
    font-size: 24px;
    font-weight: 700;
}

.dialog-details {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    width: 100%;
    max-width: 360px;
    text-align: left;
    line-height: 1.8;
    font-size: 15px;
}

.dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 360px;
    margin-top: 12px;
}

.conflict-msg {
    color: var(--accent-orange);
    font-weight: 600;
    font-size: 15px;
}

.dialog-container.conflict .dialog-icon {
    animation: shake 0.6s ease;
}

.dialog-container.success .dialog-icon {
    animation: pop 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* ========== My Day ========== */

.myday-total {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.myday-total .total-time {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent-blue);
}

.myday-total .total-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.myday-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.myday-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.myday-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.myday-item-op {
    font-weight: 600;
    font-size: 14px;
}

.myday-item-client {
    font-size: 12px;
    color: var(--text-muted);
}

.myday-item-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.myday-item-duration {
    font-weight: 700;
    font-size: 15px;
    color: var(--accent-blue);
    white-space: nowrap;
}

.myday-item.active {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.05);
}

.myday-item.active .myday-item-duration {
    color: var(--accent-green);
}

.myday-item.auto-closed {
    border-color: var(--accent-orange);
}

.myday-item.auto-closed .myday-item-duration {
    color: var(--accent-orange);
}

/* ========== Change User ========== */

.btn-change-user {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 40px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    padding: 10px 18px;
    cursor: pointer;
    z-index: 100;
    transition: var(--transition);
}

.btn-change-user:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ========== Utilities ========== */

.hidden {
    display: none !important;
}

/* ========== Responsive ========== */

@media (min-width: 640px) {
    .screen {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .timer-display {
        font-size: 80px;
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== Scrollbar ========== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ========== Group Screen ========== */
.groups-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

@media (min-width: 400px) {
    .groups-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.card-group {
    min-height: 180px;
    padding: 24px 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-group::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0.1;
    transition: opacity 0.3s;
    z-index: 0;
}

.card-group:hover::before {
    opacity: 0.2;
}

.card-group > * {
    position: relative;
    z-index: 1;
}

.group-pink {
    border-top: 3px solid #ec4899;
}
.group-pink::before { background: radial-gradient(circle at top right, #ec4899, transparent 60%); }
.group-pink:hover {
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.15);
    transform: translateY(-4px);
    border-color: rgba(236, 72, 153, 0.3);
}

.group-blue {
    border-top: 3px solid #3b82f6;
}
.group-blue::before { background: radial-gradient(circle at top right, #3b82f6, transparent 60%); }
.group-blue:hover {
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.3);
}

.group-icon {
    font-size: 56px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
    margin-bottom: 4px;
}

.group-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.card-group .card-name {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.card-group .card-subtitle {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
}

.group-actions-bottom {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
    padding: 0 10px;
}

.action-row {
    display: flex;
    gap: 16px;
}

.btn-warning-action {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.2);
}
.btn-warning-action:hover {
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.3);
    transform: translateY(-2px);
}

.btn-dashboard-action {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    flex: 2;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
}
.btn-dashboard-action:hover {
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.btn-exit-action {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    flex: 1;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
}
.btn-exit-action:hover {
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}


