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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --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);
}

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

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    font-weight: 700;
}

.mode-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.mode-indicator.dev {
    display: inline-flex;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mode-indicator.prod {
    display: inline-flex;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.mode-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    animation: pulse 2s infinite;
}

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

.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.total-cards {
    font-size: 1rem;
    color: var(--text-secondary);
}

.total-cards strong {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

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

.btn-refresh:active {
    transform: translateY(0);
}

/* Filters */
.filters {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.filter-group select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: white;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-group select:hover {
    border-color: var(--primary-color);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Loading & Error */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

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

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

.error {
    background-color: #fee2e2;
    border: 1px solid var(--danger-color);
    color: #991b1b;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Card */
.card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

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

.card.overdue::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--danger-color);
}

.card.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--success-color);
}

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

.card-key {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.card-status.overdue {
    background-color: #fee2e2;
    color: #991b1b;
}

.card-status.active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-responsible {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 3px solid var(--primary-color);
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-color);
}

.card-responsible svg {
    flex-shrink: 0;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

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

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.info-value.overdue-date {
    color: var(--danger-color);
    font-weight: 600;
}

.info-value.active-date {
    color: var(--success-color);
    font-weight: 600;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-dates {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.card-dates-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-complete-card,
.btn-waiting-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    flex: 1;
    justify-content: center;
    white-space: nowrap;
}

.btn-complete-card {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.btn-complete-card:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-waiting-card {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
}

.btn-waiting-card:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-complete-card:active,
.btn-waiting-card:active {
    transform: translateY(0);
}

.btn-complete-card svg,
.btn-waiting-card svg {
    flex-shrink: 0;
}

.btn-complete-card:disabled,
.btn-waiting-card:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 2rem 1rem;
    text-align: center;
}

.modal-header svg {
    color: var(--warning-color);
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 0 2rem 2rem;
    text-align: center;
}

.modal-card-info {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--bg-color);
    border-radius: 0.5rem;
}

.modal-card-info strong {
    color: var(--primary-color);
}

.modal-message {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.modal-warning {
    font-size: 0.875rem;
    color: var(--danger-color);
    background-color: #fee2e2;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--danger-color);
    text-align: left;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
    border-radius: 0 0 1rem 1rem;
}

.modal-footer button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-cancel:hover {
    background-color: var(--bg-color);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-confirm {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-confirm:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-confirm:active {
    transform: translateY(0);
}

.btn-confirm:disabled,
.btn-cancel:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease-out;
}

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

.toast svg {
    flex-shrink: 0;
}

.toast-success {
    background-color: var(--success-color);
    color: white;
}

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

/* Loading spinner animation for button */
.spinner {
    animation: spin 1s linear infinite;
}

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

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

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .mode-indicator {
        font-size: 0.7rem;
        padding: 0.25rem 0.625rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.25rem;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .modal-header {
        padding: 1.5rem 1.5rem 0.75rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 0 1.5rem 1.5rem;
    }

    .modal-footer {
        flex-direction: column;
        padding: 1rem 1.5rem;
    }

    .modal-footer button {
        width: 100%;
    }

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
    }

    .btn-complete-card,
    .btn-waiting-card {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        gap: 0.375rem;
    }

    .btn-complete-card svg,
    .btn-waiting-card svg {
        width: 16px;
        height: 16px;
    }

    .card-actions {
        flex-direction: column;
    }

    .btn-complete-card,
    .btn-waiting-card {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header-info {
        width: 100%;
        justify-content: space-between;
    }

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

