/* CSS Custom Properties - Light Theme */
:root {
    --primary-color: #3b82f6;
    /* Blue like the image */
    --primary-hover: #2563eb;
    --background-light: #f3f4f6;
    /* Light gray background */
    --surface-white: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-md: 0.5rem;
    /* 8px */
    --radius-lg: 1rem;
    /* 16px */
    --radius-xl: 1.5rem;
    /* 24px */
    --radius-full: 9999px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-light);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1 {
    font-size: 32px;
    font-weight: 400;
}

.logo-img {
    max-width: 50px;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

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

/* Layout */
.app-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Navigation Bar */
.top-bar {
    background-color: var(--surface-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.logo .material-icons {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.search-container {
    flex: 1;
    max-width: 500px;
}

.search-bar {
    position: relative;
    width: 100%;
}

.search-bar .material-icons {
    position: absolute;
    left: 1.15rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    pointer-events: none;
    font-size: 1.25rem;
    z-index: 1;
}

.search-bar input[type="text"] {
    width: 100%;
    background-color: var(--background-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem 0.75rem 3.25rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.search-bar input[type="text"]:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #bfdbfe;
    /* specific placeholder color */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--background-light);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-full);
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

/* Main Content Area */
.main-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem;
    flex: 1;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 3rem;
}

.welcome-section h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Analytics Cards */
.analytics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.analytics-card {
    background-color: var(--surface-white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 160px;
    position: relative;
    border: 1px solid var(--border-color);
}

.card-header-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

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

.card-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

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

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

.card-chart-placeholder {
    /* Mimic the wave in the design roughly */
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 80px;
    height: 30px;
    opacity: 0.5;
}

.next-renewal-info {
    margin-top: auto;
    text-align: center;
}

.next-renewal-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.next-renewal-date {
    font-size: 0.875rem;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    justify-content: center;
}

/* Subscriptions Table Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.table-controls {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-btn:hover {
    background-color: var(--background-light);
}


/* Table Styles */
.subs-table-container {
    background-color: var(--surface-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.subs-table {
    width: 100%;
    border-collapse: collapse;
}

.subs-table th {
    text-align: left;
    padding: 1.25rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background-color: #f9fafb;
    /* Slightly darker header */
    border-bottom: 1px solid var(--border-color);
}

.subs-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.subs-table tr:last-child td {
    border-bottom: none;
}

.subs-table tr:hover {
    background-color: #f9fafb;
}

/* Cell Contents */
.service-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.service-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.service-info {
    display: flex;
    flex-direction: column;
}

.service-name {
    font-weight: 600;
    color: var(--text-primary);
}

.service-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.active {
    background-color: var(--success-color);
}

.status-dot.expired {
    background-color: var(--danger-color);
}

.status-dot.pending {
    background-color: var(--warning-color);
}

.price-cell {
    font-weight: 600;
}

th.col-actions {
    text-align: center;
    width: 140px;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

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

.empty-state .material-icons {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal.hidden {
    display: flex !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background-color: var(--surface-white);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: none;
    transform: translateY(0) scale(1);
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.modal.hidden .modal-content {
    transform: translateY(24px) scale(0.97);
    opacity: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

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

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked~.checkmark::after {
    display: block;
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.details-content {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.detail-value.promo {
    color: var(--warning-color);
}

.detail-service-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-service-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.detail-service-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-service-header .service-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.detail-service-header .service-category {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subs-table tbody tr {
    animation: fadeSlideIn 0.22s ease both;
    animation-delay: calc(var(--row-index, 0) * 35ms);
}

.subs-table tr {
    transition: background-color 0.15s ease;
}

.analytics-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.analytics-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Confirm modal */
.modal-content--sm {
    max-width: 380px;
    text-align: center;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.confirm-icon .material-icons {
    color: var(--danger-color);
    font-size: 1.75rem;
}

.confirm-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.confirm-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Promo fields expand/collapse */
#promo-fields {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}

#promo-fields.promo-open {
    max-height: 150px;
    opacity: 1;
}

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

    .search-container {
        display: none;
        /* Hide search on mobile or move it */
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .subs-table th,
    .subs-table td {
        padding: 1rem;
    }

    /* Hide some columns on mobile */
    .col-renewal,
    .col-status {
        display: none;
    }

    .logo h1 {
        display: none;
    }

    /* Show only icon on small mobile */
}