/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    top: 2px;
}

.tab-button:hover {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

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

/* Card */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.card h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

#target-calendar,
#new-calendar-name {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: white;
}

#target-calendar:focus,
#new-calendar-name:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"],
input[type="datetime-local"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
    resize: vertical;
}

small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Recurring Options */
.recurring-section {
    border: 2px dashed var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
    background: rgba(79, 70, 229, 0.02);
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Events List */
.events-list {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.events-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.events-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background);
    border-radius: var(--radius);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.events-container {
    margin-top: 1rem;
}

.events-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

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

.events-table thead {
    background: var(--primary-color);
    color: white;
}

.events-table th,
.events-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.events-table th {
    font-weight: 600;
    white-space: nowrap;
}

.events-table tbody tr {
    transition: background-color 0.2s ease;
}

.events-table tbody tr:hover {
    background-color: var(--background);
}

.events-table tbody tr.selected {
    background-color: rgba(79, 70, 229, 0.08);
}

/* Editing state */
.events-table tbody tr.editing {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.events-table tbody tr.editing td:first-child::after {
    content: " ✏️";
    color: #ffc107;
    font-size: 14px;
    margin-left: 4px;
}

.events-table td:first-child {
    text-align: center;
    width: 40px;
}

.events-table input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.event-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-recurring {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.badge-single {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.sync-badge {
    background: #ffc107;
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    font-weight: 600;
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

button[disabled] {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

.event-actions-cell {
    white-space: nowrap;
}

.event-actions-cell button {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-or {
    margin: 1rem 0;
    color: var(--text-secondary);
}

/* CSV Preview */
.csv-preview {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.csv-table {
    width: 100%;
    overflow-x: auto;
    margin: 1rem 0;
}

.csv-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.csv-table th,
.csv-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.csv-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.csv-table tr:nth-child(even) {
    background: var(--background);
}

/* Format Guide */
.csv-format-guide {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius);
}

.format-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 1.5rem 0;
}

.format-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.format-section ul {
    list-style: none;
}

.format-section li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.format-section li:last-child {
    border-bottom: none;
}

code {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* Info Text */
.info-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem;
    font-size: 1.1rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem;
    color: var(--text-secondary);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .tab-button {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .tab-button.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .format-sections {
        grid-template-columns: 1fr;
    }

    .checkbox-group {
        grid-template-columns: 1fr 1fr;
    }

    .card {
        padding: 1.5rem;
    }
}

/* Flash Messages */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.flash-message {
    padding: 1rem 2rem 1rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    position: relative;
}

.flash-success {
    background: rgba(16, 185, 129, 0.95);
    color: white;
    border-left: 4px solid #059669;
}

.flash-error {
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border-left: 4px solid #dc2626;
}

.flash-info {
    background: rgba(79, 70, 229, 0.95);
    color: white;
    border-left: 4px solid #4338ca;
}

.flash-close {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.flash-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Success Message (for JS-generated messages) */
.success-message {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Completed Tasks Section */
#completed-tasks-section {
    margin-top: 3rem;
}

#completed-tasks-section h3 {
    color: var(--text-secondary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.completed-tasks-table {
    opacity: 0.85;
}

.completed-tasks-table tr.completed-task {
    background-color: #f8f9fa;
}

.completed-tasks-table tr.completed-task:hover {
    background-color: #e9ecef;
}

.badge-completed {
    background-color: #10b981;
    color: white;
}

/* Strike-through for completed tasks */
.completed-task strong {
    text-decoration: line-through;
    color: var(--text-secondary);
}

/* Today's Tasks Section */
.today-tasks-section {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--primary-color);
}

.today-tasks-section h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.today-stats {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.today-stats .stat-card {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

/* Today's Tasks Table */
.today-tasks-table {
    border: 2px solid var(--primary-color);
}

.today-tasks-table thead {
    background: var(--primary-color);
}

.calendar-badge {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.duration-cell {
    font-weight: 600;
    text-align: right;
    color: var(--primary-color);
}

/* Button styling for info/tag button */
.btn-info {
    background-color: #3b82f6;
    color: white;
}

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

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

/* Tablet and Mobile (768px and below) */
@media (max-width: 768px) {
    /* Container and Spacing */
    .container {
        padding: 0.5rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.875rem;
    }
    
    /* Tab Buttons */
    .tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .tab-button {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Cards */
    .card {
        padding: 1rem;
    }
    
    .card h2 {
        font-size: 1.5rem;
    }
    
    /* Forms - Prevent iOS zoom */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="datetime-local"],
    textarea,
    select {
        font-size: 16px;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn-small {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Events Actions - Stack vertically */
    .events-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .events-actions button {
        width: 100%;
        margin: 0;
    }
    
    /* Event Actions Cell - Wrap buttons */
    .event-actions-cell {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: flex-start;
    }
    
    .event-actions-cell .btn-small {
        flex: 0 0 auto;
    }
    
    /* Today's Tasks Section */
    .today-tasks-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .today-tasks-section h3 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
        cursor: pointer;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .today-stats {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Tables - Card View */
    .events-table thead {
        display: none;
    }
    
    .events-table tbody tr {
        position: relative;
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        padding: 1rem;
        background: white;
        box-shadow: var(--shadow-sm);
    }
    
    .events-table tbody tr.selected {
        background-color: rgba(79, 70, 229, 0.08);
    }
    
    .events-table tbody tr.editing {
        background-color: #fff3cd !important;
        border-left: 4px solid #ffc107;
    }
    
    .events-table tbody td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
    }
    
    /* Add labels before content */
    .events-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        margin-right: 0.5rem;
        color: var(--primary-color);
        min-width: 80px;
    }
    
    /* Position checkbox at top-right of card */
    .events-table tbody td:first-child {
        position: absolute;
        top: 1rem;
        right: 1rem;
        padding: 0;
        border: none;
    }
    
    .events-table tbody td:first-child::before {
        display: none; /* No label needed */
    }
    
    /* Style checkbox bigger for touch */
    .events-table tbody td:first-child input[type="checkbox"] {
        width: 20px;
        height: 20px;
        cursor: pointer;
    }
    
    /* Actions cell styling */
    .event-actions-cell {
        display: flex !important;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }
    
    .event-actions-cell::before {
        display: none !important;
    }
    
    .event-actions-cell .btn-small {
        flex: 1 1 auto;
        min-width: 60px;
    }
    
    /* Today's Tasks Table - Hide columns */
    .today-tasks-table th:nth-child(3),
    .today-tasks-table td:nth-child(3),
    .today-tasks-table th:nth-child(4),
    .today-tasks-table td:nth-child(4) {
        display: none;
    }
    
    /* Events Table Wrapper */
    .events-table-wrapper {
        overflow-x: visible;
        border: none;
    }
    
    /* Completed Tasks Table */
    .completed-tasks-table tbody tr {
        opacity: 0.85;
    }
}

/* Very Small Screens (480px and below) */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.25rem;
    }
    
    /* Ultra-compact Today's Tasks */
    .today-tasks-section {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .today-tasks-table {
        font-size: 0.875rem;
    }
    
    /* Smaller buttons on very small screens */
    .event-actions-cell .btn-small {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* More compact cards */
    .card {
        padding: 0.75rem;
    }
    
    .card h2 {
        font-size: 1.25rem;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes pulse-highlight {
    0% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.05); 
        background: linear-gradient(135deg, rgba(255, 215, 0, 0.4) 0%, rgba(255, 193, 7, 0.4) 100%);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }
    100% { 
        transform: scale(1); 
    }
}

.stat-value.highlight {
    animation: pulse-highlight 0.5s ease-out;
}

/* ========================================
   TAG CONFIRMATION MODAL
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h3 {
    margin: 0 0 1.5rem 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.task-name-display {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tag-hours-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.hours-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.hours-row:last-child {
    border-bottom: none;
}

.hours-row .label {
    font-weight: 500;
    color: var(--text-secondary);
}

.hours-row .value {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.hours-row.highlight-row {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.5rem;
    border-bottom: none;
}

.hours-row.highlight-row .value {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Untag modal - show reduction with different color */
.hours-row.untag-highlight {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
}

.hours-row.untag-highlight .value {
    color: #f57c00;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions .btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Mobile responsive for modal */
@media (max-width: 768px) {
    .modal-content {
        padding: 1.5rem;
        max-width: 95%;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .hours-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .hours-row .value {
        font-size: 1.5rem;
    }
}

/* ==================== Duration Tasks Styles ==================== */

/* Duration task form section */
.duration-section {
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.1) 0%, rgba(121, 134, 203, 0.1) 100%);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.duration-section h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.duration-section .info-text {
    background: rgba(255, 255, 255, 0.8);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.duration-section .info-text strong {
    color: var(--primary-color);
}

/* Duration tasks tab content */
#duration-tasks-tab .section {
    margin-bottom: 2rem;
}

#duration-tasks-tab h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#duration-tasks-tab h3 span {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Scheduling modal specific styles */
#schedule-task-modal .modal-content {
    max-width: 600px;
}

#schedule-task-modal .task-name-display {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

#schedule-task-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Slot found success display */
.slot-found {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(129, 199, 132, 0.1) 100%);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    padding: 1.5rem;
    animation: slideIn 0.3s ease-out;
}

.slot-found h4 {
    color: #4CAF50;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.slot-details {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.slot-details p {
    margin: 0.5rem 0;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slot-details strong {
    color: var(--text-color);
    font-weight: 600;
}

.slot-details span {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Slot not found error display */
.slot-not-found {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, rgba(239, 83, 80, 0.1) 100%);
    border: 2px solid #f44336;
    border-radius: 12px;
    padding: 1.5rem;
    animation: shake 0.5s ease-out;
}

.slot-not-found h4 {
    color: #f44336;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.slot-not-found p {
    color: var(--text-color);
    margin: 0.5rem 0;
    line-height: 1.6;
}

/* Animations for slot results */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Button specific for scheduling */
#find-slot-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7986cb 100%);
    border: none;
    transition: all 0.3s ease;
}

#find-slot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(103, 58, 183, 0.3);
}

/* Empty state for duration tasks */
#duration-tasks-tab .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
    font-size: 1.1rem;
    background: linear-gradient(135deg, rgba(103, 58, 183, 0.05) 0%, rgba(121, 134, 203, 0.05) 100%);
    border-radius: 12px;
    border: 2px dashed rgba(103, 58, 183, 0.3);
}

/* Mobile responsive for duration tasks */
@media (max-width: 768px) {
    .duration-section {
        padding: 1rem;
    }
    
    #schedule-task-modal .form-row {
        grid-template-columns: 1fr;
    }
    
    .slot-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .slot-details span {
        font-size: 1.3rem;
    }
    
    #duration-tasks-tab h3 {
        font-size: 1.1rem;
        flex-wrap: wrap;
    }
}

/* ==================== Edit Modal Form Styles ==================== */

#edit-task-modal .form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

#edit-task-modal .form-group {
    margin-bottom: 1rem;
}

#edit-task-modal textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

#edit-task-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

#edit-task-modal .modal-content {
    position: relative;
}

/* ==================== Modal Close Button ==================== */

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: scale(1.1);
}

/* ==================== Loading Spinner ==================== */

#loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-overlay {
    background: rgba(0, 0, 0, 0.6);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

.spinner-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile responsive for edit modal and spinner */
@media (max-width: 768px) {
    #edit-task-modal .form-row {
        grid-template-columns: 1fr;
    }
    
    #edit-task-modal .modal-content {
        max-width: 95% !important;
        padding: 1.5rem;
    }
    
    .modal-close-btn {
        top: 0.5rem;
        right: 0.5rem;
        width: 35px;
        height: 35px;
        font-size: 2rem;
    }
}

