/* Lily Dark Mode CSS (Waalaxy Inspired) */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

#lily-root {
    --lily-bg: #0f172a;
    --lily-sidebar: #0f172a;
    --lily-card: rgba(30, 41, 59, 0.6);
    --lily-primary: #3b82f6;
    --lily-primary-hover: #60a5fa;
    --lily-text: #f8fafc;
    --lily-muted: #94a3b8;
    --lily-border: rgba(255, 255, 255, 0.08);

    font-family: 'Outfit', sans-serif;
    color: var(--lily-text);
    background: var(--lily-bg);
    min-height: 85vh;
    display: flex;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin: 40px 0;
}

#lily-root * {
    box-sizing: border-box;
}

#lily-root .lily-sidebar {
    width: 180px;
    background: var(--lily-sidebar);
    border-right: 1px solid var(--lily-border);
    display: flex;
    flex-direction: column;
}

#lily-root .lily-logo {
    padding: 16px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--lily-border);
}

#lily-root .lily-nav {
    display: flex;
    flex-direction: column;
    padding: 16px 8px;
    gap: 4px;
    flex: 1;
}

#lily-root .lily-nav-item {
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--lily-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

#lily-root .lily-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

#lily-root .lily-nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--lily-primary);
    border-left: 3px solid var(--lily-primary);
}

#lily-root .lily-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--lily-border);
    font-size: 0.85rem;
    color: var(--lily-muted);
}

#lily-root .lily-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

#lily-root .lily-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

#lily-root .lily-pulse {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: lily-pulser 2s infinite;
}

@keyframes lily-pulser {
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

#lily-root .lily-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--lily-bg);
}

#lily-root .lily-header {
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--lily-border);
}

#lily-root .lily-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

#lily-root .lily-tab-content {
    display: none;
    padding: 40px;
    animation: lily-fadeIn 0.3s ease;
}

#lily-root .lily-tab-content.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#lily-root .lily-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

@media (max-width: 1024px) {
    #lily-root .lily-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    #lily-root .lily-stats-grid {
        grid-template-columns: 1fr;
    }
}

#lily-root .lily-stat-card {
    background: var(--lily-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--lily-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s;
}

#lily-root .lily-stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(139, 92, 246, 0.4);
}

#lily-root .lily-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

#lily-root .lily-stat-info {
    display: flex;
    flex-direction: column;
}

#lily-root .lily-stat-label {
    color: var(--lily-muted);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 2px;
}

#lily-root .lily-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

#lily-root .lily-section {
    margin-bottom: 40px;
}

#lily-root .lily-section-title {
    font-size: 1.2rem;
    margin-bottom: 24px;
    font-weight: 600;
}

#lily-root .lily-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

#lily-root .lily-template-card {
    background: var(--lily-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--lily-border);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

#lily-root .lily-template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--lily-primary), #ec4899);
    opacity: 0;
    transition: opacity 0.2s;
}

#lily-root .lily-template-card:hover {
    border-color: var(--lily-primary);
}

#lily-root .lily-template-card:hover::before {
    opacity: 1;
}

#lily-root .lily-template-header {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--lily-primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 16px;
}

#lily-root .lily-template-card h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
}

#lily-root .lily-template-card p {
    color: var(--lily-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Buttons */
#lily-root .lily-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

#lily-root .lily-btn-primary {
    background: var(--lily-primary);
    color: #ffffff;
}

#lily-root .lily-btn-primary:hover {
    background: var(--lily-primary-hover);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

#lily-root .lily-btn-outline {
    background: transparent;
    border: 1px solid var(--lily-border);
    color: var(--lily-text);
}

#lily-root .lily-btn-outline:hover {
    border-color: var(--lily-primary);
    background: rgba(139, 92, 246, 0.05);
}

/* Tables */
#lily-root .lily-card {
    background: var(--lily-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--lily-border);
    border-radius: 12px;
    padding: 24px;
}

#lily-root .lily-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

#lily-root .lily-table th,
#lily-root .lily-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--lily-border);
}

#lily-root .lily-table th {
    color: var(--lily-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Forms */
#lily-root .lily-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--lily-muted);
    font-weight: 500;
}

#lily-root .lily-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--lily-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

#lily-root .lily-input:focus {
    outline: none;
    border-color: var(--lily-primary);
    background: rgba(255, 255, 255, 0.05);
}

#lily-root select.lily-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23a1a1aa%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 16px top 50%;
    background-size: 12px auto;
}

/* Modal */
.lily-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.lily-modal-content {
    background: var(--lily-card, #1c1f26);
    color: var(--lily-text, #f4f4f5);
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    border: 1px solid var(--lily-border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Outfit', sans-serif;
}

.lily-modal.open {
    display: flex;
}

.lily-modal.open .lily-modal-content {
    transform: scale(1);
    opacity: 1;
}

.lily-modal-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--lily-border, rgba(255, 255, 255, 0.08));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lily-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.lily-close-modal {
    background: transparent;
    border: none;
    color: var(--lily-muted, #a1a1aa);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.lily-close-modal:hover {
    color: white;
}

.lily-modal-body {
    padding: 30px;
}

.lily-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--lily-border, rgba(255, 255, 255, 0.08));
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#lily-root .lily-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

#lily-root .lily-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

#lily-root .lily-badge.paused {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #lily-root {
        flex-direction: column;
        height: auto;
        min-height: auto;
        margin: 0;
    }

    #lily-root .lily-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: none;
    }

    #lily-root .lily-logo {
        border-bottom: 1px solid var(--lily-border);
    }

    .hide-on-mobile {
        display: none !important;
    }

    .mobile-header-actions {
        display: flex !important;
        align-items: center;
        gap: 6px;
    }

    #lily-root .lily-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0;
        gap: 0;
        border-bottom: 1px solid var(--lily-border);
    }

    #lily-root .lily-nav::-webkit-scrollbar {
        display: none;
    }

    #lily-root .sidebar-category-title {
        display: none !important;
    }

    #lily-root .lily-nav-item {
        flex: 0 0 auto;
        padding: 16px;
        border-radius: 0;
    }

    #lily-root .lily-nav-item span {
        display: none;
    }

    #lily-root .lily-nav-item.active {
        border-left: none !important;
        border-bottom: 3px solid var(--lily-primary) !important;
        background: transparent !important;
    }

    #lily-root .lily-nav-item.active span {
        display: inline;
    }

    #lily-root .lily-tab-content {
        padding: 16px;
    }

    #lily-root .lily-stats-grid {
        grid-template-columns: 1fr;
    }

    #dashboard-templates-grid {
        grid-template-columns: 1fr !important;
    }

    #dashboard-templates-section>div:first-child {
        flex-direction: column;
        align-items: stretch !important;
        gap: 16px;
    }

    #dashboard-template-search {
        width: 100% !important;
    }
    
    #lily-root .lily-section-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px;
    }
    
    #lily-root .lily-section-actions {
        flex-wrap: wrap !important;
    }
    
    #lily-root .lily-section-actions .lily-input {
        width: 100% !important;
        flex: 1 1 100%;
        margin-bottom: 8px;
    }
    
    #lily-root .lily-section-actions .lily-btn {
        flex: 1;
        justify-content: center;
    }
    
    #lily-root .lily-section-actions.search-wrap .lily-input {
        margin-bottom: 0;
    }
    
    #lily-root .lily-section-title {
        margin-bottom: 4px !important;
    }
}