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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #EDEEF7 0%, #E4FBFF 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Better text rendering */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Paper Texture Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(120, 104, 230, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(184, 181, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 180, 180, 0.05) 0%, transparent 50%);
    background-size: 100px 100px, 150px 150px, 200px 200px;
    pointer-events: none;
    z-index: -1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(120, 104, 230, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(120, 104, 230, 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo-link {
    text-decoration: none;
    display: inline-block;
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.02);
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: #7868E6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    transition: filter 0.3s ease;
}

.logo-link:hover .logo-img {
    filter: drop-shadow(0 4px 8px rgba(120, 104, 230, 0.3));
}

.logo-text {
    color: #7868E6;
    font-size: 1.8rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Legacy support for emoji icon */
.logo-icon {
    font-size: 2rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: linear-gradient(135deg, rgba(120, 104, 230, 0.1), rgba(184, 181, 255, 0.1));
    border: 2px solid rgba(120, 104, 230, 0.2);
    cursor: pointer;
    padding: 0.6rem;
    color: #7868E6;
    position: relative;
    z-index: 101;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(120, 104, 230, 0.1);
}

.mobile-menu-toggle:hover {
    background: linear-gradient(135deg, rgba(120, 104, 230, 0.2), rgba(184, 181, 255, 0.2));
    border-color: #7868E6;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.2);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle .close-icon {
    display: none;
}

.mobile-menu-toggle.active .menu-icon {
    display: none;
}

.mobile-menu-toggle.active .close-icon {
    display: block;
}

.nav {
    display: flex;
    gap: 2rem;
}

/* Hide mobile header on desktop */
.mobile-nav-header {
    display: none;
}

.nav-links-wrapper {
    display: contents;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.nav-link * {
    pointer-events: none;
}

.nav-link:hover,
.nav-link.active {
    color: #7868E6;
    background: rgba(184, 181, 255, 0.2);
}

/* Main Content */
.main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Buttons */
.btn {
    background: #7868E6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    min-height: 44px;
    white-space: nowrap;
}

.btn:hover {
    background: #6854d1;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
}

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

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile button adjustments */
@media (max-width: 768px) {
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        min-height: 48px;
    }
}

.btn-primary {
    background: #7868E6;
}

.btn-secondary {
    background: #B8B5FF;
    color: #333;
}

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

.btn-outline {
    background: transparent;
    color: #7868E6;
    border: 2px solid #7868E6;
}

.btn-outline:hover {
    background: #7868E6;
    color: white;
}

.btn-danger {
    background: #FFB4B4;
    color: #d63031;
}

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

/* Input Fields */
.input-field {
    padding: 0.75rem;
    border: 2px solid rgba(120, 104, 230, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: #7868E6;
    background: white;
    box-shadow: 0 0 0 3px rgba(120, 104, 230, 0.1);
}

/* Prevent zoom on iOS */
@media (max-width: 768px) {
    .input-field,
    select.input-field {
        font-size: 16px;
    }
}

/* Creator Section */
.creator-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.creator-header .header-text {
    flex: 1;
    min-width: 250px;
}

.creator-header h2 {
    color: #7868E6;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.subtitle {
    color: #666;
    font-size: 1rem;
    margin: 0;
    font-weight: 400;
}

.routine-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.routine-controls .input-field {
    min-width: 220px;
    flex: 1;
}

/* Onboarding Banner */
.onboarding-banner {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.2);
    animation: slideDown 0.5s ease;
}

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

.onboarding-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.onboarding-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.onboarding-text {
    flex: 1;
}

.onboarding-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
}

.onboarding-text p {
    margin: 0;
    opacity: 0.95;
    line-height: 1.5;
}

.btn-close-onboarding {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-onboarding:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.creator-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    min-height: 600px;
}

/* Activities Panel */
.activities-panel {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
    border: 1px solid rgba(120, 104, 230, 0.1);
}

.panel-header {
    margin-bottom: 1.5rem;
}

.panel-header h3 {
    color: #7868E6;
    margin-bottom: 0.5rem;
}

.panel-hint,
.form-hint,
.section-hint {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}


.activities-panel h3 {
    color: #7868E6;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activities-panel h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Button Icons */
.btn-icon {
    font-style: normal;
    margin-right: 0.3rem;
}

.btn .btn-icon {
    display: inline-block;
}

.activity-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.category-btn {
    background: rgba(184, 181, 255, 0.3);
    color: #7868E6;
    border: 2px solid transparent;
    padding: 0.5rem 0.85rem;
    border-radius: 18px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    gap: 0.3rem;
}

.category-btn.active,
.category-btn:hover {
    background: #B8B5FF;
    color: white;
    border-color: #7868E6;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(120, 104, 230, 0.2);
}

/* Mobile category buttons */
@media (max-width: 768px) {
    .category-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: 40px;
    }

    .category-icon {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .category-btn {
        padding: 0.6rem 0.85rem;
        font-size: 0.8rem;
        min-height: 44px;
    }

    .category-icon {
        font-size: 14px;
    }
}

.activities-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.activity-item {
    background: rgba(228, 251, 255, 0.5);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    touch-action: none;
}

.activity-item:hover {
    background: #E4FBFF;
    transform: translateX(5px);
    border-color: #7868E6;
}

.activity-item:active {
    cursor: grabbing;
}

.activity-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Mobile-friendly activities */
@media (max-width: 1024px) {
    .activity-item {
        cursor: pointer;
        padding: 1rem;
        min-height: 56px;
        border: 2px solid rgba(120, 104, 230, 0.25);
        box-shadow: 0 3px 12px rgba(120, 104, 230, 0.12);
        position: relative;
        background: linear-gradient(135deg, rgba(228, 251, 255, 0.6), rgba(237, 238, 247, 0.4));
    }

    .activity-item:active {
        background: linear-gradient(135deg, #7868E6, #B8B5FF);
        border-color: #7868E6;
        transform: scale(0.97);
        box-shadow: 0 2px 8px rgba(120, 104, 230, 0.3);
    }

    .activity-item:active .activity-name,
    .activity-item:active .activity-duration {
        color: white;
    }

    .activity-item:active .activity-category {
        background: rgba(255, 255, 255, 0.3);
        color: white;
    }

    .activity-info {
        max-width: 100%;
    }
}

.activity-info {
    flex: 1;
}

.activity-name {
    font-weight: 600;
    color: #333;
}

.activity-duration {
    font-size: 0.8rem;
    color: #666;
}

.activity-category {
    background: #7868E6;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
}

/* Custom Activity Form */
.add-custom-activity {
    border-top: 1px solid rgba(120, 104, 230, 0.2);
    padding-top: 1rem;
}

.add-custom-activity h4 {
    color: #7868E6;
    margin-bottom: 0.5rem;
}

.custom-activity-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.custom-activity-form .input-field {
    font-size: 0.9rem;
    padding: 0.65rem;
    min-height: 44px;
}

.custom-activity-form button {
    grid-column: 1 / -1;
    padding: 0.75rem;
    font-size: 0.9rem;
    min-height: 48px;
}

/* Mobile form adjustments */
@media (max-width: 480px) {
    .custom-activity-form {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .custom-activity-form .input-field {
        font-size: 16px;
        padding: 0.875rem;
        min-height: 48px;
    }

    .custom-activity-form button {
        font-size: 1rem;
        padding: 0.875rem;
        min-height: 50px;
    }
}

/* Timeline Panel */
.timeline-panel {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
    border: 1px solid rgba(120, 104, 230, 0.1);
}

.timeline-panel h3 {
    color: #7868E6;
    margin-bottom: 1rem;
}

.timeline-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.timeline-controls label {
    font-weight: 500;
    color: #333;
}

.timeline-info {
    color: #7868E6;
    font-weight: 600;
}

.timeline-container {
    min-height: 400px;
    border: 2px dashed rgba(120, 104, 230, 0.3);
    border-radius: 8px;
    position: relative;
}

.timeline-dropzone {
    min-height: 400px;
    padding: 1rem;
    position: relative;
}

/* Mobile timeline optimization */
@media (max-width: 768px) {
    .timeline-container {
        min-height: 300px;
    }

    .timeline-dropzone {
        min-height: 300px;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .timeline-container {
        min-height: 250px;
    }

    .timeline-dropzone {
        min-height: 250px;
        padding: 0.5rem;
    }

    .activity-item {
        padding: 0.9rem;
    }

    .activity-info {
        max-width: 100%;
    }

    .activity-name {
        font-size: 0.9rem;
        font-weight: 600;
    }

    .activity-duration {
        font-size: 0.75rem;
    }

    .activity-category {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }
}

.timeline-dropzone.drag-over {
    border-color: #7868E6;
    background: rgba(120, 104, 230, 0.1);
}

.drop-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
    text-align: center;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.drop-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
    word-wrap: break-word;
}

.drop-hint {
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
    opacity: 0.7;
    word-wrap: break-word;
}

/* Mobile drop message */
@media (max-width: 768px) {
    .drop-message {
        width: 95%;
        padding: 0 0.5rem;
        max-width: 95%;
    }

    .drop-text {
        font-size: 1rem;
        padding: 0 0.5rem;
    }

    .drop-hint {
        font-size: 0.85rem;
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .drop-message {
        width: calc(100% - 2rem);
        padding: 0;
        left: 1rem;
        right: 1rem;
        transform: translate(0, -50%);
    }

    .drop-icon {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }

    .drop-text {
        font-size: 0.9rem;
        line-height: 1.4;
        padding: 0 0.5rem;
    }

    .drop-hint {
        font-size: 0.75rem;
        line-height: 1.3;
        padding: 0 0.5rem;
    }
}

/* Duration Badge */
.duration-badge {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
}

.timeline-activity {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    transition: all 0.3s ease;
    position: relative;
    min-height: 44px;
}

.timeline-activity:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(120, 104, 230, 0.3);
}

/* Timeline mobile optimization */
@media (max-width: 768px) {
    .timeline-activity {
        padding: 1rem;
        min-height: 56px;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .timeline-activity-info {
        flex: 1 1 100%;
        min-width: 0;
    }

    .timeline-activity-duration {
        order: 2;
    }

    .remove-activity {
        order: 3;
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }
}

.timeline-activity-info {
    flex: 1;
}

.timeline-activity-name {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.timeline-activity-time {
    font-size: 0.8rem;
    opacity: 0.9;
}

.timeline-activity-duration {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.remove-activity {
    background: rgba(255, 180, 180, 0.8);
    color: #d63031;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-activity:hover {
    background: #FFB4B4;
    transform: scale(1.1);
}

/* Simulator Section */
.simulator-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.simulator-header .header-text {
    flex: 1;
    min-width: 250px;
}

.simulator-header h2 {
    color: #7868E6;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.simulator-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.simulation-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.simulation-status {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
}

.current-activity h3 {
    color: #7868E6;
    margin-bottom: 1rem;
}

.activity-card {
    background: linear-gradient(135deg, #E4FBFF, #EDEEF7);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #7868E6;
    margin-bottom: 1.5rem;
}

.activity-card.current {
    background: linear-gradient(135deg, #7868E6, #B8B5FF);
    color: white;
    border-left-color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.activity-card h4 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.activity-card p {
    margin-bottom: 0.5rem;
}

.simulation-progress h4 {
    color: #7868E6;
    margin-bottom: 1rem;
}

.progress-bar {
    background: rgba(120, 104, 230, 0.2);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    background: linear-gradient(90deg, #7868E6, #B8B5FF);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
}

.simulation-timeline {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
}

.simulation-timeline h3 {
    color: #7868E6;
    margin-bottom: 1rem;
}

.simulation-activities {
    max-height: 400px;
    overflow-y: auto;
}

.simulation-activity {
    background: rgba(228, 251, 255, 0.5);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border-left: 4px solid #ccc;
    transition: all 0.3s ease;
    min-height: 44px;
}

.simulation-activity.completed {
    background: rgba(184, 181, 255, 0.3);
    border-left-color: #B8B5FF;
}

.simulation-activity.active {
    background: rgba(120, 104, 230, 0.2);
    border-left-color: #7868E6;
    transform: translateX(5px);
}

/* Mobile simulation activities */
@media (max-width: 480px) {
    .simulation-activity {
        padding: 1rem;
        min-height: 56px;
    }

    .simulation-activity h5 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .simulation-activity p {
        font-size: 0.9rem;
    }

    .simulation-activity small {
        font-size: 0.8rem;
    }
}

.simulation-feedback {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
}

.simulation-feedback h3 {
    color: #7868E6;
    margin-bottom: 1rem;
}

.feedback-content {
    color: #666;
    line-height: 1.6;
}

/* Library Section */
.library-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.library-header .header-text {
    flex: 1;
    min-width: 250px;
}

.library-header h2 {
    color: #7868E6;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.routine-templates h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.library-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.routines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.routine-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
    border: 1px solid rgba(120, 104, 230, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.routine-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(120, 104, 230, 0.2);
}

.routine-card h4 {
    color: #7868E6;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.routine-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.routine-activities {
    margin-bottom: 1rem;
}

.routine-activities h5 {
    color: #333;
    margin-bottom: 0.5rem;
}

.activity-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.activity-tag {
    background: rgba(184, 181, 255, 0.3);
    color: #7868E6;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
}

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

.routine-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-height: 40px;
}

/* Mobile routine cards */
@media (max-width: 480px) {
    .routine-actions {
        gap: 0.5rem;
    }

    .routine-actions .btn {
        flex: 1;
        min-width: 80px;
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        min-height: 44px;
    }
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.template-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(120, 104, 230, 0.1);
    text-align: center;
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(120, 104, 230, 0.15);
}

.template-card h4 {
    color: #7868E6;
    margin-bottom: 0.5rem;
}

.template-card p {
    color: #666;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    padding: 1rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideUp 0.3s ease;
}

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

.close {
    color: #aaa;
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: rgba(120, 104, 230, 0.1);
    z-index: 1;
}

.close:hover {
    color: #7868E6;
    background: rgba(120, 104, 230, 0.2);
    transform: rotate(90deg);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    max-width: calc(100vw - 40px);
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #7868E6;
    animation: slideIn 0.3s ease;
    max-width: 350px;
    word-wrap: break-word;
    cursor: pointer;
}

.toast.success {
    border-left-color: #00b894;
}

.toast.error {
    border-left-color: #FFB4B4;
}

.toast.warning {
    border-left-color: #fdcb6e;
}

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

/* Toast mobile optimization */
@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-width: 100%;
    }

    .toast {
        max-width: 100%;
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
        animation: slideUp 0.3s ease;
    }

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

/* Footer */
.footer {
    background: linear-gradient(135deg, rgba(237, 238, 247, 0.95), rgba(228, 251, 255, 0.95));
    backdrop-filter: blur(10px);
    border-top: 2px solid transparent;
    border-image: linear-gradient(90deg, transparent, rgba(120, 104, 230, 0.3), transparent) 1;
    padding: 3rem 0 1.5rem;
    color: #666;
    margin-top: 4rem;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #7868E6, #B8B5FF, transparent);
    border-radius: 0 0 10px 10px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-section p {
    margin: 0;
    line-height: 1.8;
    font-size: 0.9rem;
}

.footer-section strong {
    color: #7868E6;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: inline-block;
    font-weight: 700;
    letter-spacing: 0.3px;
    position: relative;
}

.footer-section strong::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #7868E6, transparent);
    border-radius: 2px;
}

.footer-section a {
    color: #7868E6;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    padding: 0.25rem 0;
}

.footer-section a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #7868E6, #B8B5FF);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.footer-section a:hover::before {
    width: 100%;
}

.footer-section a:hover {
    color: #6854d1;
}

/* Footer bottom bar */
.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(120, 104, 230, 0.15);
    color: #999;
    font-size: 0.85rem;
}

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

    .header .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        position: relative;
    }

    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .logo {
        font-size: 1.5rem;
    }

    .logo-img {
        height: 42px;
    }

    .logo-text {
        font-size: 1.5rem;
    }

    /* Mobile Navigation */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 260px;
        max-width: 80vw;
        height: 100vh;
        background: linear-gradient(135deg, rgba(237, 238, 247, 0.98), rgba(228, 251, 255, 0.98));
        backdrop-filter: blur(20px);
        flex-direction: column;
        gap: 0;
        padding: 0;
        box-shadow: -8px 0 40px rgba(120, 104, 230, 0.2);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        overflow-y: auto;
        border-left: 1px solid rgba(120, 104, 230, 0.1);
    }

    .mobile-nav-header {
        display: none;
    }

    .nav.active {
        right: 0;
    }

    /* Mobile menu header - only visible in mobile */
    .mobile-nav-header {
        display: flex;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: linear-gradient(135deg, #7868E6, #B8B5FF);
        z-index: 10;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.3rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        box-shadow: 0 2px 10px rgba(120, 104, 230, 0.2);
        flex-shrink: 0;
    }

    .nav-links-wrapper {
        display: flex;
        flex-direction: column;
        flex: 1;
    }

    .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        border: none;
        width: 100%;
        text-align: left;
        margin-top: 0;
        background: transparent;
        position: relative;
        font-weight: 500;
    }

    .nav-link:first-child {
        border-top: 2px solid rgba(120, 104, 230, 0.2);
        box-shadow: 0 -2px 10px rgba(120, 104, 230, 0.05);
    }

    .nav-link:not(:last-child) {
        border-bottom: 1px solid rgba(120, 104, 230, 0.08);
    }

    /* Mobile nav link structure */
    .nav-link {
        opacity: 0;
        transform: translateX(20px);
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .nav-icon {
        color: #7868E6;
        flex-shrink: 0;
        transition: all 0.3s ease;
        width: 20px;
        height: 20px;
    }

    .nav-link-text {
        flex: 1;
        pointer-events: none;
    }

    .nav-link svg {
        pointer-events: none;
    }

    .nav-link:hover .nav-icon {
        transform: scale(1.15);
        filter: drop-shadow(0 2px 4px rgba(120, 104, 230, 0.3));
    }

    .nav.active .nav-link {
        opacity: 1;
        transform: translateX(0);
    }

    .nav.active .nav-link:nth-child(1) { transition-delay: 0.15s; }
    .nav.active .nav-link:nth-child(2) { transition-delay: 0.2s; }
    .nav.active .nav-link:nth-child(3) { transition-delay: 0.25s; }
    .nav.active .nav-link:nth-child(4) { transition-delay: 0.3s; }

    .nav-link::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 0;
        background: linear-gradient(135deg, #7868E6, #B8B5FF);
        border-radius: 0 4px 4px 0;
        transition: height 0.3s ease;
    }

    .nav-link:hover::before,
    .nav-link.active::before {
        height: 60%;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(255, 255, 255, 0.6);
        color: #7868E6;
        padding-left: 2rem;
        box-shadow: inset 0 0 20px rgba(120, 104, 230, 0.05);
    }

    .nav-link:active {
        transform: translateX(3px);
    }

    /* Overlay for mobile menu */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, rgba(120, 104, 230, 0.4), rgba(0, 0, 0, 0.6));
        backdrop-filter: blur(4px);
        z-index: 99;
        animation: fadeIn 0.4s ease;
    }

    @keyframes fadeIn {
        from { 
            opacity: 0;
            backdrop-filter: blur(0);
        }
        to { 
            opacity: 1;
            backdrop-filter: blur(4px);
        }
    }

    /* Menu bottom decoration */
    .nav-link:last-child {
        margin-bottom: 1rem;
    }

    .nav-link:last-child::after {
        content: '';
        position: absolute;
        bottom: -0.5rem;
        left: 1.5rem;
        right: 1.5rem;
        height: 2px;
        background: linear-gradient(90deg, transparent, #7868E6, transparent);
        opacity: 0.3;
    }

    .creator-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .simulation-content {
        grid-template-columns: 1fr;
    }

    /* Mobile-friendly drag and drop message */
    .drop-text::after {
        content: ' (toque nas atividades)';
        display: block;
        margin-top: 0.5rem;
        color: #7868E6;
        font-weight: 500;
        font-size: 0.9rem;
    }

    .drop-hint {
        display: none;
    }

    .activity-item {
        cursor: pointer;
        position: relative;
    }

    /* Onboarding banner mobile */
    .onboarding-banner {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .onboarding-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .onboarding-icon-modern {
        width: 60px;
        height: 60px;
    }

    .onboarding-icon-modern svg {
        width: 30px;
        height: 30px;
    }

    .onboarding-text h3 {
        font-size: 1.1rem;
    }

    .onboarding-text p {
        font-size: 0.95rem;
    }

    .btn-close-onboarding {
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
    }

    /* Header text mobile */
    .creator-header .header-text,
    .simulator-header .header-text,
    .library-header .header-text {
        text-align: center;
        min-width: 100%;
    }

    .creator-header h2,
    .simulator-header h2,
    .library-header h2 {
        font-size: 1.7rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .creator-header,
    .simulator-header,
    .library-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .routine-controls,
    .simulator-controls,
    .library-controls {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
        gap: 0.75rem;
    }

    .routine-controls .input-field,
    .simulator-controls .input-field,
    .library-controls .input-field {
        width: 100%;
        min-width: 100%;
        flex: 1 1 100%;
    }

    .routine-controls .btn,
    .simulator-controls .btn,
    .library-controls .btn {
        flex: 1 1 auto;
        min-width: 100px;
    }

    /* Simulator controls layout */
    .simulator-controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    #routine-selector {
        grid-column: 1 / -1;
    }

    #start-simulation,
    #pause-simulation,
    #reset-simulation {
        min-width: 100%;
    }

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

    .timeline-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .timeline-controls label {
        font-size: 1rem;
    }

    .timeline-controls .input-field {
        width: 100%;
        font-size: 16px;
        min-height: 48px;
    }

    .timeline-info {
        font-size: 1rem;
        padding: 0.5rem;
        text-align: center;
    }

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

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

    .modal-content {
        margin: 2rem auto;
        width: 100%;
        max-width: calc(100vw - 2rem);
        padding: 1.5rem;
        padding-top: 3rem;
        max-height: 90vh;
        border-radius: 16px;
    }

    .close {
        width: 40px;
        height: 40px;
        font-size: 24px;
        top: 0.75rem;
        right: 0.75rem;
    }

    #modal-body {
        font-size: 0.95rem;
    }

    .routine-details {
        font-size: 0.95rem;
    }

    .activity-timeline .timeline-item {
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    .progress-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer {
        padding: 2.5rem 0 1.25rem;
        margin-top: 3rem;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        text-align: center;
        margin-bottom: 1.25rem;
    }

    .footer-section strong {
        font-size: 0.95rem;
    }

    .footer-section p {
        font-size: 0.85rem;
    }

    .footer-bottom {
        font-size: 0.8rem;
        padding-top: 1.25rem;
    }
}

@media (max-width: 600px) {
    .footer {
        padding: 1.5rem 0 0.75rem;
    }

    .footer::before {
        width: 50px;
        height: 2px;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem 1rem;
        margin-bottom: 1rem;
        text-align: left;
    }

    .footer-section {
        padding-bottom: 0;
    }

    .footer-section:not(:last-child) {
        border-bottom: none;
    }

    .footer-section strong {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }

    .footer-section strong::after {
        display: none;
    }

    .footer-section p {
        font-size: 0.75rem;
        line-height: 1.6;
    }

    .footer-section a::before {
        display: none;
    }

    .footer-section {
        gap: 0.35rem;
    }

    .footer-bottom {
        font-size: 0.7rem;
        padding-top: 0.75rem;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.3rem;
        gap: 0.5rem;
    }

    .logo-img {
        height: 36px;
    }

    .logo-text {
        font-size: 1.3rem;
    }

    /* Footer ultra-compacto */
    .footer {
        padding: 1.25rem 0 0.5rem;
    }

    .footer-content {
        gap: 1rem 0.75rem;
        margin-bottom: 0.75rem;
    }

    .footer-section strong {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }

    .footer-section p {
        font-size: 0.7rem;
        line-height: 1.5;
    }

    .footer-section {
        gap: 0.25rem;
    }

    .footer-bottom {
        font-size: 0.65rem;
        padding-top: 0.5rem;
    }

    /* Ajustes para telas muito pequenas */
    .nav {
        width: 240px;
        max-width: 90vw;
    }

    .mobile-nav-header {
        height: 60px;
        font-size: 1.2rem;
    }

    .nav-link {
        padding: 0.9rem 1.25rem;
        font-size: 0.95rem;
        gap: 0.6rem;
    }

    .nav-icon {
        width: 18px;
        height: 18px;
    }

    .activities-panel,
    .timeline-panel {
        padding: 1rem;
    }

    .panel-header h3 {
        font-size: 1.1rem;
    }

    .panel-hint,
    .form-hint {
        font-size: 0.85rem;
    }

    .activity-categories {
        justify-content: center;
    }

    .activities-list {
        max-height: 250px;
    }

    .timeline-controls label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .routine-card,
    .template-card {
        padding: 1.25rem;
    }

    .routine-card h4 {
        font-size: 1.1rem;
    }

    .routine-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .routine-stats span {
        font-size: 0.9rem;
    }

    .template-card h4 {
        font-size: 1.1rem;
    }

    .template-card p {
        font-size: 0.95rem;
    }

    .template-btn {
        min-height: 48px;
        width: 100%;
    }

    .toast {
        max-width: calc(100vw - 40px);
    }

    .routine-controls,
    .simulator-controls,
    .library-controls {
        width: 100%;
    }

    .routine-controls .input-field,
    .simulator-controls .input-field {
        width: 100%;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
.input-field:focus,
.nav-link:focus,
.activity-item:focus,
.category-btn:focus,
.timeline-activity:focus {
    outline: 2px solid #7868E6;
    outline-offset: 2px;
}

/* Focus visible (modern browsers) */
.btn:focus-visible,
.input-field:focus-visible,
.nav-link:focus-visible,
.activity-item:focus-visible,
.category-btn:focus-visible,
.timeline-activity:focus-visible {
    outline: 3px solid #7868E6;
    outline-offset: 2px;
}

/* Remove outline for mouse users */
.btn:focus:not(:focus-visible),
.nav-link:focus:not(:focus-visible),
.category-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles */
@media print {
    .header,
    .footer,
    .btn,
    .nav {
        display: none;
    }

    body {
        background: white;
    }

    .main {
        padding: 0;
    }

    .timeline-activity,
    .routine-card {
        break-inside: avoid;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }

    .activity-item,
    .timeline-activity,
    .routine-card {
        border: 1px solid currentColor;
    }
    
    .input-field {
        border: 2px solid currentColor;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(120, 104, 230, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(120, 104, 230, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 104, 230, 0.7);
}

/* Mobile scrollbar - thinner */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

.container {
    overflow-x: hidden;
}
