/* ============================================
   SaaS Subscription Management Platform
   Responsive UI Styles
   ============================================ */

/* CSS Variables */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --secondary: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --dark-secondary: #374151;
    --light: #f9fafb;
    --light-secondary: #f3f4f6;
    --white: #ffffff;
    --gray: #6b7280;
    --gray-light: #d1d5db;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
    --sidebar-width: 280px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-secondary);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   Layout Structure
   ============================================ */

body {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Mobile Header
   ============================================ */

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.mobile-header .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.mobile-header .logo i {
    font-size: 1.5rem;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--dark);
    border-radius: 2px;
    transition: var(--transition);
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar .logo i {
    font-size: 1.75rem;
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--light-secondary);
    color: var(--dark);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
}

.nav-item i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
}

.user-email {
    font-size: 0.75rem;
    color: var(--gray);
}

.logout-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--light-secondary);
    border: none;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--danger);
    color: var(--white);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    flex: 1;
    max-width: 400px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-box i {
    color: var(--gray);
}

.search-box input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 0.875rem;
    color: var(--dark);
}

.search-box input::placeholder {
    color: var(--gray);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--dark-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: var(--transition);
}

.notification-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    font-size: 0.625rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
}

/* Dashboard Content */
.dashboard-content {
    max-width: 1400px;
}

/* Welcome Section */
.welcome-section {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.welcome-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.welcome-text p {
    color: var(--gray);
    font-size: 0.9375rem;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray);
    font-size: 0.875rem;
    background: var(--white);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    gap: 16px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--gray);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-change {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--secondary);
}

.stat-change.negative {
    color: var(--danger);
}

.stat-change.neutral {
    color: var(--gray);
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

.view-all {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: var(--transition);
}

.view-all:hover {
    gap: 10px;
}

/* Subscriptions Section */
.subscriptions-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.subscriptions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subscription-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.subscription-item:hover {
    background: var(--light-secondary);
}

.sub-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sub-icon.google {
    background: rgba(66, 133, 244, 0.1);
    color: #4285f4;
}

.sub-icon.slack {
    background: rgba(74, 21, 75, 0.1);
    color: #4a154b;
}

.sub-icon.github {
    background: rgba(24, 23, 23, 0.1);
    color: #181717;
}

.sub-icon.figma {
    background: rgba(242, 78, 30, 0.1);
    color: #f24e1e;
}

.sub-icon.zoom {
    background: rgba(45, 140, 255, 0.1);
    color: #2d8cff;
}

.sub-details {
    flex: 1;
    min-width: 0;
}

.sub-details h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.sub-details p {
    font-size: 0.75rem;
    color: var(--gray);
}

.sub-price {
    text-align: right;
    flex-shrink: 0;
}

.sub-price .price {
    display: block;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.875rem;
}

.sub-price .renewal {
    font-size: 0.6875rem;
    color: var(--gray);
}

.sub-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sub-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.sub-status.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.sub-menu {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sub-menu:hover {
    background: var(--white);
    color: var(--dark);
}

/* Usage Section */
.usage-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.period-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--gray);
    background: var(--white);
    cursor: pointer;
}

.usage-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.usage-card {
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.usage-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.usage-label {
    font-size: 0.8125rem;
    color: var(--gray);
    font-weight: 500;
}

.usage-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dark);
}

.usage-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.usage-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.usage-progress.warning {
    background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%);
}

.usage-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--gray);
}

.usage-trend {
    color: var(--secondary);
}

.usage-trend.warning {
    color: var(--warning);
}

/* Bottom Grid */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

/* Renewals Section */
.renewals-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.renewals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.renewal-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.renewal-date {
    width: 48px;
    height: 48px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.renewal-date .day {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.renewal-date .month {
    font-size: 0.625rem;
    color: var(--gray);
    text-transform: uppercase;
    font-weight: 500;
}

.renewal-details {
    flex: 1;
    min-width: 0;
}

.renewal-details h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.renewal-details p {
    font-size: 0.75rem;
    color: var(--gray);
}

.renewal-action {
    padding: 6px 16px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.renewal-action:hover {
    background: var(--primary-dark);
}

/* Billing Section */
.billing-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.billing-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.billing-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.billing-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.billing-icon.paid {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.billing-icon.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.billing-details {
    flex: 1;
    min-width: 0;
}

.billing-details h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.billing-details p {
    font-size: 0.75rem;
    color: var(--gray);
}

.billing-amount {
    text-align: right;
    flex-shrink: 0;
}

.billing-amount span {
    display: block;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.875rem;
}

.billing-status {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.billing-status.paid {
    color: var(--secondary);
}

.billing-status.pending {
    color: var(--warning);
}

/* Actions Section */
.actions-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

.action-btn i {
    font-size: 1.5rem;
    color: var(--primary);
    transition: var(--transition);
}

.action-btn:hover i {
    color: var(--white);
}

.action-btn span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--dark);
    transition: var(--transition);
}

.action-btn:hover span {
    color: var(--white);
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .bottom-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .actions-section {
        grid-column: span 2;
    }
}

/* Large Mobile */
@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar .close-sidebar {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 84px;
    }
    
    .top-bar {
        margin-bottom: 20px;
    }
    
    .add-btn span {
        display: none;
    }
    
    .add-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
        border-radius: var(--radius-sm);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .main-content {
        padding: 84px 16px 20px;
    }
    
    .welcome-text h1 {
        font-size: 1.375rem;
    }
    
    .date-display {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .subscription-item {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .sub-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .sub-details {
        flex: 1 1 calc(100% - 56px);
    }
    
    .sub-price {
        flex: 1 1 100%;
        text-align: left;
        display: flex;
        gap: 12px;
        align-items: center;
    }
    
    .sub-status {
        order: 5;
        margin-left: 52px;
    }
    
    .sub-menu {
        position: absolute;
        right: 8px;
        top: 8px;
    }
    
    .subscription-item {
        position: relative;
    }
    
    .bottom-grid {
        grid-template-columns: 1fr;
    }
    
    .actions-section {
        grid-column: span 1;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .top-bar-actions {
        gap: 8px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .welcome-text h1 {
        font-size: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
    
    .stat-icon {
        margin: 0 auto;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .stat-info {
        align-items: center;
    }
    
    .stat-value {
        font-size: 1.125rem;
    }
    
    .stat-change {
        font-size: 0.625rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .renewal-item {
        flex-wrap: wrap;
    }
    
    .renewal-details {
        flex: 1 1 calc(100% - 64px);
    }
    
    .renewal-action {
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
    
    .billing-item {
        flex-wrap: wrap;
    }
    
    .billing-details {
        flex: 1 1 calc(100% - 48px);
    }
    
    .billing-amount {
        flex: 1 1 100%;
        text-align: left;
        margin-left: 48px;
        margin-top: 4px;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.subscription-item,
.renewal-item,
.billing-item,
.action-btn {
    animation: fadeIn 0.4s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.subscription-item:nth-child(1) { animation-delay: 0.1s; }
.subscription-item:nth-child(2) { animation-delay: 0.15s; }
.subscription-item:nth-child(3) { animation-delay: 0.2s; }
.subscription-item:nth-child(4) { animation-delay: 0.25s; }
.subscription-item:nth-child(5) { animation-delay: 0.3s; }

/* Smooth hover effects */
.stat-card,
.subscription-item,
.renewal-item,
.billing-item,
.action-btn {
    opacity: 0;
}

