:root {
    --bg-color: #0f1115;
    --panel-bg: rgba(25, 28, 36, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8f9fa;
    --text-secondary: #a0a5b1;
    --accent-color: #d4af37; /* Gold for premium feel */
    --accent-hover: #f1c40f;
    --accent-glow: rgba(212, 175, 55, 0.3);
    --danger: #e74c3c;
    --success: #2ecc71;
    --warning: #f39c12;
    --deadline-color: #ff4757; /* Red/Orange for Overdue */
    --input-bg: rgba(15, 17, 21, 0.8);
    --input-border: rgba(255, 255, 255, 0.12);
    --font-family: 'Outfit', sans-serif;
    --nav-height: 70px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
    padding-bottom: var(--nav-height);
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #3498db 0%, transparent 70%);
    bottom: -50px;
    left: -100px;
}

/* Container */
.app-container {
    width: 100%;
    max-width: 650px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--panel-border);
}

.header-titles h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff, var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-titles p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.header-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--panel-bg);
    border: 1px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Page Logic */
.pages-container {
    position: relative;
    width: 100%;
}

.page {
    display: none;
    animation: fadeInPage 0.3s ease-out;
}

.page.active {
    display: block;
}

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

/* Glass Panel Utilities */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Form Styles */
.form-section h2, .filters-section h2 {
    font-size: 1.2rem;
    margin-bottom: 0;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 16px;
    width: 100%;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.form-group:focus-within label {
    color: var(--accent-color);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    font-family: var(--font-family);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.input-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
}

.input-icon input {
    padding-left: 40px;
}

/* Custom Select */
.select-wrapper {
    position: relative;
    width: 100%;
}

select {
    appearance: none;
    cursor: pointer;
    padding-right: 40px;
}

.select-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Toggles & Dynamic Content */
.toggle-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-label {
    font-weight: 500;
    font-size: 1rem;
}

.dynamic-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}

.dynamic-content.active {
    max-height: 800px;
    opacity: 1;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--input-border);
}

.nested-dynamic {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dotted rgba(255,255,255,0.1);
    animation: fadeIn 0.3s ease-out;
}

.nested-dynamic.active {
    display: block;
}

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

/* Custom Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .4s;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background-color: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

/* Button */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-color), #b8962e);
    color: #111;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary.edit-mode {
    background: linear-gradient(135deg, #3498db, #2980b9);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-primary.edit-mode:hover {
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

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

.btn-cancel-edit {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-cancel-edit:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tasks-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.tasks-count {
    background: var(--accent-color);
    color: #000;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--panel-bg);
    border: 1px dashed var(--input-border);
    border-radius: 16px;
    color: var(--text-secondary);
    gap: 12px;
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* Task Card */
.task-card {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.4s ease-out forwards;
}

.task-card.status-completed {
    opacity: 0.7;
}

.task-card.status-completed::before {
    background: var(--success);
}

.task-card.status-pending::before {
    background: var(--accent-color);
}

.task-card.status-overdue {
    border-color: rgba(255, 71, 87, 0.5);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.15);
}

.task-card.status-overdue::before {
    background: var(--deadline-color);
    box-shadow: 0 0 10px var(--deadline-color);
}

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

.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 5px;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    padding-right: 40px; /* Space for complete button */
}

.task-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.task-date-piso {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.task-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-card.status-overdue .task-meta {
    color: #ffda79;
}

.task-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.badge-comm {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.badge-mat {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.badge-status-completed {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.badge-status-overdue {
    background: rgba(255, 71, 87, 0.15);
    color: var(--deadline-color);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.task-details {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.detail-row {
    display: flex;
    margin-bottom: 6px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    width: 100px;
    font-weight: 500;
    color: #ccc;
    flex-shrink: 0;
}

.detail-value {
    flex: 1;
    word-break: break-word;
}

.email-copy-box {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0,0,0,0.4);
    border-radius: 6px;
    border-left: 2px solid #3498db;
    font-family: monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    max-height: 100px;
    overflow-y: auto;
}

/* Card Actions */
.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
}

.btn-icon.edit:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.15);
}

.btn-icon.delete:hover {
    color: var(--danger);
    background: rgba(231, 76, 60, 0.15);
}

.btn-complete-main {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #2ecc71;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-complete-main:hover {
    background: var(--success);
    color: #111;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    flex: 1;
    height: 100%;
    transition: color 0.3s;
}

.nav-item i {
    font-size: 1.2rem;
    transition: transform 0.3s;
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--accent-color);
}

.nav-item.active i {
    transform: translateY(-2px);
}

/* Email Card Styles */
.email-card {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.4s ease-out forwards;
}

.email-card.type-sent {
    border-left: 4px solid #3498db;
}

.email-card.type-received {
    border-left: 4px solid #9b59b6;
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.email-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.email-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.email-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.email-body-box {
    margin-top: 8px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-left: 2px solid rgba(255,255,255,0.1);
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
}

/* Home Page Styles */
.home-hero {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    text-align: center;
}

.home-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-bottom: 1px solid var(--panel-border);
}

.home-content {
    padding: 30px 20px;
}

.home-content h2 {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 12px;
}

.home-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.home-features {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
    display: inline-block;
}

.home-features li {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.home-features i {
    color: var(--success);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .app-container {
        padding: 16px;
        padding-bottom: 24px;
    }
    
    .glass-panel {
        padding: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}
