/* assets/css/components.css - UI Components & Elements */

/* ── Page Header ── */
.ciro-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.ciro-page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
}

.ciro-page-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ── Buttons ── */
.ciro-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    gap: 0.5rem;
    white-space: nowrap;
}

.ciro-btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.ciro-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.ciro-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.ciro-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
}

.ciro-btn-ghost:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.ciro-btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
}

.ciro-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ── Cards ── */
.ciro-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.ciro-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .ciro-card {
        padding: 1.25rem;
        border-radius: 20px;
    }
}

.ciro-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

/* ── Tables ── */
.ciro-table {
    width: 100%;
    border-collapse: collapse;
}

.ciro-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.ciro-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
    .ciro-responsive-table {
        border: none;
        overflow-x: visible;
    }

    .ciro-table thead {
        display: none;
        /* Hide headers on mobile */
    }

    .ciro-table,
    .ciro-table tbody,
    .ciro-table tr,
    .ciro-table td {
        display: block;
        width: 100%;
    }

    .ciro-table tr {
        margin-bottom: 1rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 1rem;
    }

    .ciro-table td {
        text-align: right;
        padding: 0.5rem 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .ciro-table td::before {
        content: attr(data-label);
        float: left;
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
    }
}

.ciro-amount {
    font-weight: 700;
    color: var(--accent);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
}

/* ── Forms ── */
.ciro-form-group {
    margin-bottom: 1.5rem;
}

.ciro-label {
    display: block;
    margin-bottom: 0.65rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ciro-input,
.ciro-form input,
.ciro-form select,
.ciro-form textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem 1.15rem;
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: block;
}

/* Light theme overrides for inputs */
body.ciro-theme-light .ciro-input,
body.ciro-theme-light .ciro-form input,
body.ciro-theme-light .ciro-form select,
body.ciro-theme-light .ciro-form textarea {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ciro-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.75rem;
}

.ciro-form select option {
    background-color: var(--bg-sidebar);
    color: var(--text);
}

.ciro-input:focus,
.ciro-form input:focus,
.ciro-form select:focus,
.ciro-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

body.ciro-theme-light .ciro-input:focus,
body.ciro-theme-light .ciro-form input:focus,
body.ciro-theme-light .ciro-form select:focus,
body.ciro-theme-light .ciro-form textarea:focus {
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.ciro-input::placeholder,
.ciro-form input::placeholder,
.ciro-form textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.ciro-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ── Toggle Switch ── */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

input:focus+.slider {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* ── Widget Toggle List (Inside Modal) ── */
.widget-toggle-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.widget-toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: var(--transition);
}

.widget-toggle-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

.widget-toggle-item span {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.ciro-form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.ciro-pay-row-form {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr 1.5fr auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.5rem;
    border-radius: 14px;
}

@media (max-width: 768px) {
    .ciro-pay-row-form {
        grid-template-columns: 1fr 1fr;
    }

    .ciro-pay-row-form input.pay-ref,
    .ciro-pay-row-form select.pay-account-sel {
        grid-column: span 2;
    }
}

/* ── Filter Bar ── */
.ciro-filter-bar {
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.ciro-filter-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    opacity: 0.6;
}

.ciro-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
}

.ciro-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ciro-filter-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-left: 2px;
}

.ciro-filter-form select,
.ciro-filter-form input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 1.1rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 150px;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ciro-filter-form select:focus,
.ciro-filter-form input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.1);
    outline: none;
}

/* Specific button overrides for filter bar */
.ciro-filter-form .ciro-btn {
    padding: 0.75rem 1.5rem;
    height: 46px;
    /* Match input height */
    border-radius: 12px;
}

/* ── Modals & Overlays ── */
.ciro-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ciro-modal-overlay.open {
    display: flex;
}

.ciro-modal {
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }

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

.ciro-modal-header {
    padding: 1.75rem 2.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.ciro-modal-header h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
    color: #fff;
}

.ciro-modal-body {
    padding: 2.25rem;
    overflow-y: auto;
    flex: 1;
}

.ciro-modal-footer {
    padding: 1.5rem 2.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.1);
}

/* Modal Close Button Helper */
.ciro-modal-close-btn {
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.ciro-modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* ── Tabs ── */
.ciro-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
}

.ciro-tab {
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.ciro-tab:hover {
    color: var(--text);
}

.ciro-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Status Badges ── */
.ciro-status-badge,
.ciro-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ciro-status-badge.active,
.ciro-status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

.ciro-status-badge.passive,
.ciro-status-badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* ── Alerts & Badges ── */
.ciro-alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.ciro-alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

.ciro-alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.ciro-badge-sm {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--primary-light);
    color: var(--primary);
}

/* ── Context Menu ── */
#ciro-context-menu {
    position: fixed;
    display: none;
    z-index: 10000;
    background: rgba(15, 15, 20, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 180px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.context-menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.context-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 0.4rem;
}

/* ── Form Extras ── */
.ciro-form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    margin-top: 1rem;
}

.ciro-form-check input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* ── Helpers ── */
.ciro-empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.ciro-empty-state-inline {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.ciro-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.ciro-link:hover {
    text-decoration: underline;
}

.text-danger {
    color: var(--error) !important;
}

.text-success {
    color: var(--success) !important;
}

.ciro-text-muted {
    color: var(--text-muted);
}

/* ── Quick Grid & Cards ── */
.ciro-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.ciro-quick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    gap: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.ciro-quick-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 15px 30px -10px rgba(99, 102, 241, 0.3);
}

.ciro-quick-card svg {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary);
    transition: var(--transition);
}

.ciro-quick-card:hover svg {
    transform: scale(1.1);
}

.ciro-quick-card span {
    font-weight: 700;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
}

.ciro-quick-card.ciro-quick-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
}

.ciro-quick-card.ciro-quick-primary svg {
    color: white;
}

.ciro-quick-card.ciro-quick-primary:hover {
    box-shadow: 0 15px 35px -10px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

/* ── Quick Action Buttons (Compact) ── */
.ciro-btn-quick {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.ciro-btn-quick:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.ciro-btn-quick .price-tag {
    opacity: 0.6;
    font-weight: 400;
    font-size: 0.8rem;
}

/* PWA Install Modal */
.pwa-modal {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    width: 90%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(10px);
}

.pwa-modal.open {
    transform: translateX(-50%) translateY(0);
}

.pwa-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    border-radius: 1rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.pwa-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.pwa-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.pwa-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.pwa-install-btn {
    flex: 1;
    padding: 0.8rem;
    border-radius: 1rem;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.pwa-close-btn {
    padding: 0.8rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: none;
    cursor: pointer;
}