/*
 * To-Do Board v1.3 - Stylesheet
 * 
 * Estructura de estilos:
 * 1. Reset & Base Styles
 * 2. Layout & Container (Column System)
 * 3. Card Styles
 * 4. Card States (active, completed, collapsed)
 * 5. Card Components (header, tasks, footer, timer)
 * 6. Modal Styles
 * 7. Notification Styles
 * 8. Responsive Design
 */

/* ========================================
   1. RESET & BASE STYLES
   ======================================== */

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

body {
    font-family: 'Noto Sans', sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.4;
}

/* ========================================
   2. LAYOUT & CONTAINER (COLUMN SYSTEM)
   ======================================== */

.container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 1px; /* Para que las columnas mantengan altura mínima */
}

/* ========================================
   3. CARD STYLES
   ======================================== */

.card {
    background: #fafafa;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    width: 100%;
    position: relative;
    transition: all 0.3s ease;
}

/* ========================================
   4. CARD STATES
   ======================================== */

/* Active State - Timer Running */
.card.active {
    background: #deb082;
    color: #333333;
}

/* Completed State - All Tasks Done */
.card.completed {
    background: #63a37d;
    color: #fafafa;
}

/* Collapsed State - Minimized View */
.card.collapsed {
    padding: 12px 24px;
}

/* State-specific Input Styles */
.card.active input,
.card.completed input,
.card.active textarea,
.card.completed textarea {
    color: inherit;
    background: transparent;
}

.card.active input:focus,
.card.completed input:focus,
.card.active textarea:focus,
.card.completed textarea:focus {
    background: rgba(255,255,255,0.1);
    color: inherit;
}

/* ========================================
   5. CARD COMPONENTS
   ======================================== */

/* --- Creation Date & Controls --- */
.creation-date {
    position: absolute;
    top: 8px;
    left: 24px;
    font-size: 10px;
    color: #333333;
    font-weight: 500;
}

.card.active .creation-date {
    color: #333333;
}

.card.completed .creation-date {
    color: rgba(250,250,250,0.7);
}

.card-controls {
    position: absolute;
    top: 8px;
    right: 24px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.collapse-btn, .delete-btn-header {
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.collapse-btn:hover, .delete-btn-header:hover {
    color: #333333;
    opacity: 1;
}

/* Chevron icon for collapse button */
.chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
}

.chevron.up {
    border-width: 0 5px 7px 5px;
    border-color: transparent transparent currentColor transparent;
}

.chevron.down {
    border-width: 7px 5px 0 5px;
    border-color: currentColor transparent transparent transparent;
}

.card.active .collapse-btn,
.card.active .delete-btn-header {
    color: #333333;
}

.card.completed .collapse-btn,
.card.completed .delete-btn-header {
    color: #fafafa;
    opacity: 0.8;
}

.card.active .collapse-btn:hover,
.card.active .delete-btn-header:hover {
    background: rgba(255,255,255,0.2);
    opacity: 1;
}

.card.completed .collapse-btn:hover,
.card.completed .delete-btn-header:hover {
    background: rgba(255,255,255,0.2);
    opacity: 1;
}

.delete-btn-header {
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
}

/* --- Card Header --- */
.card-header {
    margin-bottom: 16px;
    margin-top: 12px;
}

.card-info input {
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    width: 100%;
    color: inherit;
}

.card-info input:focus {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    padding: 2px 4px;
}

.brand-input {
    font-size: 20px !important;
    font-weight: bold !important;
    margin-bottom: 4px !important;
    color: #333333 !important;
}

.project-input {
    font-size: 14px !important;
    color: #333333 !important;
    opacity: 0.7;
    font-weight: normal !important;
}

.card.active .brand-input,
.card.active .project-input {
    color: #333333 !important;
}

.card.active .project-input {
    opacity: 0.8;
}

.card.completed .brand-input,
.card.completed .project-input {
    color: #fafafa !important;
}

.card.completed .project-input {
    opacity: 0.8;
}

/* --- Tasks Section --- */
.tasks-section {
    margin: 16px 0;
}

.task-item {
    display: flex;
    align-items: flex-start;
    margin: 8px 0;
    padding: 6px 0;
    justify-content: space-between;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #333333;
    border-radius: 50%;
    margin-left: 12px;
    margin-top: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    order: 2;
}

.task-checkbox.completed {
    background: #333333;
    color: #fafafa;
}

.task-checkbox.completed::after {
    content: '✓';
    font-size: 10px;
}

.card.active .task-checkbox,
.card.completed .task-checkbox {
    border-color: currentColor;
    color: inherit;
}

.card.active .task-checkbox.completed {
    background: #333333;
    color: #deb082;
}

.card.completed .task-checkbox.completed {
    background: #fafafa;
    color: #63a37d;
}

.task-text {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    color: #333333;
    line-height: 1.6;
    min-height: 22px;
    height: auto;
    overflow: hidden;
    resize: none;
    order: 1;
    margin-right: 8px;
    padding: 2px 0;
    display: block;
    word-break: break-word;
}

.card.active .task-text {
    color: #333333;
}

.card.completed .task-text {
    color: #fafafa;
}

.task-text:focus {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    padding: 2px 4px;
    width: calc(100% - 4px);
}

.task-text.completed {
    text-decoration: line-through;
    opacity: 0.7;
}

.task-text.placeholder {
    color: #333333;
    opacity: 0.4;
    font-style: italic;
}

.card.active .task-text.placeholder {
    color: #333333;
    opacity: 0.5;
}

.card.completed .task-text.placeholder {
    color: rgba(250,250,250,0.6);
}

.add-task-btn {
    width: 100%;
    padding: 6px;
    border: 2px dashed #333333;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #333333;
    margin-top: 12px;
    transition: all 0.3s ease;
}

.add-task-btn:hover {
    border-color: #333333;
    color: #333333;
}

.card.active .add-task-btn {
    border-color: #333333;
    color: #333333;
}

.card.completed .add-task-btn {
    border-color: rgba(250,250,250,0.3);
    color: #fafafa;
}

.card.active .add-task-btn:hover {
    border-color: #333333;
    background: #333333;
    color: #fafafa;
}

.card.completed .add-task-btn:hover {
    border-color: currentColor;
    background: rgba(255,255,255,0.1);
}

/* --- Card Footer --- */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #333333;
}

.rate-earned {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.rate-earned div h3 {
    font-size: 10px;
    color: #333333;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card.active .rate-earned div h3 {
    color: #333333;
}

.card.completed .rate-earned div h3 {
    color: rgba(250,250,250,0.8);
}

.rate-input, .earned-display {
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: bold;
    font-family: inherit;
    width: 70px;
    color: #333333;
}

.card.active .rate-input,
.card.active .earned-display {
    color: #333333;
}

.card.completed .rate-input,
.card.completed .earned-display {
    color: #fafafa;
}

.rate-input:focus {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    padding: 2px 4px;
}

.card.active .card-footer {
    border-top-color: #333333;
}

.card.completed .card-footer {
    border-top-color: rgba(250,250,250,0.3);
    opacity: 1;
}

/* --- Timer Control --- */
.timer-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 12px 16px;
    border-top: 1px solid #333333;
}

.play-btn {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 2px solid #333333;
    background: #fafafa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #333333;
    transition: all 0.3s ease;
}

.play-btn:hover {
    background: #333333;
    color: #fafafa;
}

.card.active .play-btn {
    background: #333333;
    border-color: #333333;
    color: #deb082;
}

.card.completed .play-btn {
    background: #fafafa;
    border-color: #fafafa;
    color: #63a37d;
}

.timer-display {
    font-family: 'Noto Sans', sans-serif;
    font-size: 16px;
    color: #333333;
    font-weight: bold;
}

.card.active .timer-display,
.card.completed .timer-display {
    color: inherit !important;
    font-weight: bold;
}

.card.active .timer-control {
    background: rgba(255,255,255,0.1);
    border-top-color: #333333;
}

.card.completed .timer-control {
    background: rgba(255,255,255,0.1);
    border-top-color: rgba(250,250,250,0.3);
    opacity: 1;
}

/* --- Collapsed State Overrides --- */
.card.collapsed .tasks-section,
.card.collapsed .card-footer,
.card.collapsed .timer-control {
    display: none;
}

.card.collapsed .project-input {
    display: none;
}

/* --- Delete Button (Hidden) --- */
.delete-btn {
    background: none;
    border: none;
    color: #ff4757;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: none;
}

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

/* ========================================
   6. FLOATING ADD BUTTON
   ======================================== */

.add-card-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #333333;
    color: #fafafa;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

.add-card-btn:hover {
    transform: scale(1.1);
    background: #555;
}

/* ========================================
   7. MODAL STYLES
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fafafa;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Noto Sans', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #333333;
    color: #fafafa;
}

.btn-primary:hover {
    background: #555;
}

.btn-secondary {
    background: #eee;
    color: #333333;
}

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

.modal-card input {
    color: #333333 !important;
    background: transparent !important;
}

.modal-card input.placeholder {
    color: #333333 !important;
    opacity: 0.4;
    font-style: italic;
}

.modal-card input:focus {
    background: rgba(0,0,0,0.05) !important;
}

/* --- Confirm Modal --- */
.confirm-modal-content {
    max-width: 340px;
    text-align: center;
    padding: 32px 28px 24px;
}

.confirm-modal-message {
    font-size: 15px;
    color: #333333;
    line-height: 1.5;
    margin-bottom: 24px;
}

.btn-danger {
    background: #e05050;
    color: #fafafa;
}

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

/* ========================================
   8. NOTIFICATION STYLES
   ======================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333333;
    color: #fafafa;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 3000;
    max-width: 350px;
    font-family: 'Noto Sans', sans-serif;
    animation: notificationSlideIn 0.4s ease;
}

.notification.show {
    display: block;
}

.notification.hide {
    animation: notificationSlideOut 0.4s ease forwards;
}

@keyframes notificationSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes notificationSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification-header {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 16px;
}

.notification-body {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 12px;
}

.notification-buttons {
    display: flex;
    gap: 10px;
}

.notification-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Noto Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-btn.primary {
    background: #deb082;
    color: #333333;
}

.notification-btn.primary:hover {
    background: #e6c299;
}

.notification-btn.secondary {
    background: rgba(255,255,255,0.1);
    color: #fafafa;
    border: 1px solid rgba(255,255,255,0.2);
}

.notification-btn.secondary:hover {
    background: rgba(255,255,255,0.2);
}

/* ========================================
   9. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .container {
        max-width: 1200px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 992px;
    }
}

@media (max-width: 768px) {
    .container {
        gap: 15px;
        max-width: 768px;
    }
    
    body {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
    }

    .card.collapsed {
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .column {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
/* ========================================
   LOADING OVERLAY (Phase 2 — API)
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   CONFIRM MODAL
   ======================================== */

.confirm-modal-content {
    max-width: 340px;
    text-align: center;
    padding: 32px 28px 24px;
}

.confirm-modal-message {
    font-size: 15px;
    color: #333333;
    line-height: 1.5;
    margin-bottom: 24px;
}

.btn-danger {
    background: #e05050;
    color: #fafafa;
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Noto Sans', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* ========================================
   SYNC INDICATOR
   ======================================== */

.sync-indicator {
    position: fixed;
    bottom: 34px;
    right: 102px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 1001;
    transition: background-color 0.4s ease;
}

.sync-indicator.ok {
    background: #63a37d;
    box-shadow: 0 0 0 2px rgba(99, 163, 125, 0.25);
}

.sync-indicator.syncing {
    background: #deb082;
    animation: pulse 1s ease-in-out infinite;
}

.sync-indicator.error {
    background: #e05050;
    box-shadow: 0 0 0 2px rgba(224, 80, 80, 0.25);
}

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