/**
 * Массовое списание времени — WOW UI ✨
 */

:root {
    /* Градиенты */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-dark: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
    --gradient-bg: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    
    /* Цвета */
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #38ef7d;
    --success-dark: #11998e;
    --warning: #f5576c;
    --text: #1a1a2e;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --white: #ffffff;
    --border: rgba(102, 126, 234, 0.1);
    
    /* Эффекты */
    --shadow-sm: 0 2px 8px rgba(102, 126, 234, 0.08);
    --shadow-md: 0 4px 20px rgba(102, 126, 234, 0.12);
    --shadow-lg: 0 8px 40px rgba(102, 126, 234, 0.16);
    --shadow-xl: 0 20px 60px rgba(102, 126, 234, 0.2);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);
    --shadow-success: 0 4px 20px rgba(56, 239, 125, 0.3);
    
    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --blur: blur(20px);
    
    /* Размеры */
    --radius: 20px;
    --radius-lg: 28px;
    --radius-sm: 12px;
    
    /* Анимации */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--gradient-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
.app {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.app::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(56, 239, 125, 0.05) 0%, transparent 40%);
    animation: bgFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, 2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-icon {
    width: 36px;
    height: 36px;
    padding: 8px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    color: white;
    box-shadow: var(--shadow-md);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: var(--shadow-md); }
    50% { transform: scale(1.05); box-shadow: var(--shadow-glow); }
}

.header-date {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: capitalize;
    padding-left: 4px;
}

.header-right {
    display: flex;
    gap: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn svg {
    width: 18px;
    height: 18px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.btn-primary:hover svg {
    transform: rotate(-10deg) scale(1.1);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    color: var(--text);
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover svg {
    transform: rotate(180deg);
}

.btn.loading span {
    opacity: 0;
}

.btn.loading .btn-spinner {
    display: block;
}

.btn-spinner {
    display: none;
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Stats Cards */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    padding: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:nth-child(1) .stat-value { color: var(--primary); }
.stat-card:nth-child(2) .stat-value { color: var(--success-dark); }
.stat-card:nth-child(3) .stat-value { color: var(--secondary); }

.stat-card:nth-child(2)::before { background: var(--gradient-success); }
.stat-card:nth-child(3)::before { background: var(--gradient-warning); }

.stat-value {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 4px;
    transition: var(--transition);
}

.stat-card:hover .stat-value {
    transform: scale(1.1);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

.loading p {
    font-size: 16px;
    font-weight: 500;
}

/* Empty State */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px;
    color: var(--text-muted);
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
}

.empty svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.4;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty p {
    font-size: 18px;
    font-weight: 500;
}

/* Table */
.table-wrap {
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

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

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

.table thead {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: var(--transition);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.table tbody tr:hover td {
    transform: scale(1.01);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.th-task { width: 28%; }
.th-project { width: 14%; }
.th-activity { width: 12%; }
.th-logged { width: 13%; }
.th-input { width: 16%; }
.th-comment { width: 17%; }

.td-project,
.td-activity {
    color: var(--text-muted);
    font-size: 13px;
}

.td-logged {
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
}

.td-logged.has-time {
    color: var(--success-dark);
    position: relative;
}

.td-logged.has-time::before {
    content: '✓';
    margin-right: 6px;
    font-size: 12px;
}

/* Task Link */
.task-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    display: inline-block;
    position: relative;
}

.task-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

.task-link:hover {
    color: var(--primary);
}

.task-link:hover::after {
    width: 100%;
}

.link-icon {
    width: 14px;
    height: 14px;
    margin-left: 6px;
    opacity: 0;
    transform: translateX(-5px);
    transition: var(--transition);
    vertical-align: middle;
    flex-shrink: 0;
}

.task-link:hover .link-icon {
    opacity: 0.7;
    transform: translateX(0);
}

/* Inputs */
.time-input-wrap {
    position: relative;
}

.time-input,
.comment-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: white;
}

.time-input:focus,
.comment-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.time-input.error {
    border-color: var(--warning);
    background: rgba(245, 87, 108, 0.05);
    animation: shake 0.5s ease-in-out;
}

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

.time-input {
    padding-right: 100px;
}

.time-hint {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--success-dark);
    background: rgba(56, 239, 125, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    opacity: 0;
    transition: var(--transition-bounce);
    white-space: nowrap;
}

.time-hint.visible {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* Cards (Mobile) */
.cards {
    display: none;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
    animation: slideUp 0.5s ease-out;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.card-header .task-link {
    flex: 1;
    font-size: 15px;
}

.card-logged {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(102, 126, 234, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.card-logged.has-time {
    color: var(--success-dark);
    background: rgba(56, 239, 125, 0.15);
}

.card-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    max-width: 420px;
    padding: 20px 24px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transform: translateY(120px);
    opacity: 0;
    transition: var(--transition-bounce);
    z-index: 1000;
    border-left: 5px solid var(--primary);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    border-left-color: var(--success-dark);
}

.notification.success::before {
    content: '✓';
    font-size: 20px;
    font-weight: bold;
    color: var(--success-dark);
}

.notification.error {
    border-left-color: var(--warning);
}

.notification.error::before {
    content: '✕';
    font-size: 20px;
    font-weight: bold;
    color: var(--warning);
}

.notification.warning {
    border-left-color: #f59e0b;
}

.notification.warning::before {
    content: '!';
    font-size: 20px;
    font-weight: bold;
    color: #f59e0b;
}

.notification-text {
    flex: 1;
    font-weight: 600;
    color: var(--text);
}

.notification-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

.notification-close:hover {
    color: var(--text);
    transform: rotate(90deg);
}

/* Row animation on save */
.table tbody tr.saving {
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: savePulse 1s ease-in-out;
}

@keyframes savePulse {
    0%, 100% { background-position: -100% 0; }
    50% { background-position: 100% 0; }
}

/* Responsive */
@media (max-width: 1024px) {
    .th-project,
    .td-project {
        display: none;
    }
    
    .th-task { width: 32%; }
    .th-activity { width: 15%; }
    .th-logged { width: 15%; }
    .th-input { width: 18%; }
    .th-comment { width: 20%; }
}

@media (max-width: 768px) {
    .app {
        padding: 16px;
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .header-title {
        font-size: 22px;
    }
    
    .header-icon {
        width: 30px;
        height: 30px;
    }
    
    .header-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .btn {
        padding: 12px 20px;
    }
    
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px 12px;
        border-radius: var(--radius);
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    /* Hide table, show cards */
    .table-wrap {
        display: none !important;
    }
    
    .cards {
        display: block !important;
    }
    
    .notification {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-card {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 16px 20px;
    }
    
    .stat-value {
        order: 2;
        font-size: 22px;
    }
    
    .stat-label {
        order: 1;
    }
    
    .stat-card:hover .stat-value {
        transform: none;
    }
    
    .header-right {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Selection */
::selection {
    background: rgba(102, 126, 234, 0.2);
}
