/* Portal Styles - FountainPen */

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

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f1f5f9;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tenant Management Styles */
.tenants-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.tenants-table th,
.tenants-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.tenants-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.tenant-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tenant-name {
    font-weight: 600;
    color: #1e293b;
}

.tenant-domain {
    font-size: 0.875rem;
    color: #64748b;
}

.tenant-email {
    font-size: 0.75rem;
    color: #9ca3af;
}

.plan-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.plan-starter {
    background-color: #dbeafe;
    color: #1e40af;
}

.plan-professional {
    background-color: #dcfce7;
    color: #166534;
}

.plan-enterprise {
    background-color: #fef3c7;
    color: #92400e;
}

.usage-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.usage-bar {
    width: 100%;
    height: 4px;
    background-color: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    border: 1px solid #ef4444;
}

.btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

/* Tenant Cards Grid */
.tenants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.tenant-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
    position: relative;
}

.tenant-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.tenant-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.tenant-details {
    margin-bottom: 1rem;
}

.tenant-details p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.tenant-actions {
    display: flex;
    gap: 0.5rem;
}

/* Ensure no stray numeric badges appear on tenant cards */
.tenant-card .current-badge,
.tenant-card .badge {
    display: none !important;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.usage-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.usage-text {
    font-size: 0.875rem;
    color: #64748b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .tenants-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .tenants-table {
        font-size: 0.875rem;
    }
    
    .tenants-table th,
    .tenants-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content .logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

.loading-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Portal Layout */
.portal-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sidebar .logo {
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    border-bottom: 1px solid #e2e8f0;
}

.nav-menu {
    flex: 1;
    padding: 1rem 0;
    list-style: none;
}

.nav-menu li {
    margin-bottom: 0.25rem;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.nav-menu a:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.nav-menu a.active {
    background: #eff6ff;
    color: #2563eb;
    border-right: 3px solid #2563eb;
}

.user-info {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.user-details {
    margin-bottom: 1rem;
}

.user-name {
    font-weight: 600;
    color: #1e293b;
}

.user-role {
    font-size: 0.85rem;
    color: #64748b;
}

.firm-name {
    font-size: 0.8rem;
    color: #94a3b8;
}

.logout-btn {
    width: 100%;
    padding: 0.5rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #e2e8f0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    background: #f8fafc;
}

/* Page Header */
.page-header {
    background: white;
    padding: 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e293b;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.usage-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.usage-text {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.usage-bar {
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: #10b981;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.usage-fill.warning {
    background: #f59e0b;
}

.usage-fill.danger {
    background: #ef4444;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Content Cards */
.content-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin: 2rem;
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.card-subtitle {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    justify-content: center;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #475569;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

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

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
}

.btn-icon.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.btn-icon.danger:hover {
    background: #fee2e2;
}

/* Form Elements */
.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #2563eb;
}

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

.users-table th {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    border-bottom: 1px solid #e2e8f0;
}

.users-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.users-table tr:hover {
    background: #f8fafc;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-weight: 500;
    color: #1e293b;
}

.user-email {
    font-size: 0.875rem;
    color: #64748b;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Badges */
.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-badge.admin {
    background: #dbeafe;
    color: #1e40af;
}

.role-badge.user {
    background: #f0fdf4;
    color: #166534;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* 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(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-large .modal-content {
    max-width: 1200px;
}

.modal-header {
    background: #f8fafc;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f1f5f9;
    color: #374151;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    background: #f8fafc;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-radius: 0 0 12px 12px;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #6b7280;
    font-size: 0.75rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 1.5rem;
}

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

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* Responsive Design for Tablets */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }
    
    .main-content {
        margin-left: 260px;
    }
    
    .subscription-grid,
    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Responsive Design for Mobile and iPhone */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding-top: 60px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
        padding: 1.5rem 1rem;
        margin-top: 0;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .header-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .content-card {
        margin: 1rem;
        border-radius: 8px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
        padding: 1.25rem;
    }
    
    .card-header h2 {
        font-size: 1.125rem;
    }
    
    .card-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .search-input {
        flex: 1;
        min-width: 150px;
    }
    
    /* Mobile-friendly table */
    .users-table {
        font-size: 0.875rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .users-table thead {
        display: none;
    }
    
    .users-table tbody {
        display: block;
    }
    
    .users-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 1rem;
        background: white;
    }
    
    .users-table td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
    }
    
    .users-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        color: #64748b;
        font-size: 0.75rem;
        text-transform: uppercase;
        margin-bottom: 0.25rem;
    }
    
    .tenants-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tenants-table thead {
        display: none;
    }
    
    .tenants-table tbody {
        display: block;
    }
    
    .tenants-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 1rem;
        background: white;
    }
    
    .tenants-table td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
    }
    
    .tenants-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        color: #64748b;
        font-size: 0.75rem;
        text-transform: uppercase;
        margin-bottom: 0.25rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        width: calc(100% - 1rem);
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-wrap: wrap;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }
    
    /* Subscription page mobile */
    .trial-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .upgrade-now-btn {
        margin-left: 0;
        margin-top: 1rem;
        width: 100%;
    }
    
    .subscription-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .plans-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* iPhone Specific Optimizations */
@media (max-width: 430px) {
    body {
        font-size: 16px; /* Prevents zoom on input focus */
    }
    
    .btn {
        min-height: 44px; /* Apple's recommended touch target */
        padding: 0.75rem 1rem;
    }
    
    .btn-icon {
        width: 44px;
        height: 44px;
    }
    
    .page-header {
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.375rem;
    }
    
    .content-card {
        margin: 0.75rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on input focus */
        min-height: 44px;
    }
    
    .search-input,
    .filter-select {
        font-size: 16px;
        min-height: 44px;
    }
    
    /* Stack buttons vertically on small screens */
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Improve sidebar on small screens */
    .sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    .nav-menu a {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Better spacing for trial banner */
    .trial-banner {
        padding: 1.5rem;
    }
    
    .trial-info h3 {
        font-size: 1.25rem;
    }
    
    .plan-card {
        padding: 1.5rem;
    }
    
    /* Improve usage indicators */
    .usage-indicator {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .usage-bar {
        width: 100%;
    }
}

/* iPhone SE and smaller (375px and below) */
@media (max-width: 375px) {
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .card-header h2 {
        font-size: 1rem;
    }
    
    .content-card {
        margin: 0.5rem;
    }
    
    .sidebar {
        width: 90%;
    }
    
    .trial-info h3 {
        font-size: 1.125rem;
    }
    
    .trial-info p {
        font-size: 0.875rem;
    }
    
    .plan-price .price {
        font-size: 1.75rem;
    }
}

/* Landscape orientation fixes for iPhone */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .page-header {
        padding: 0.75rem 1rem;
    }
    
    .content-card {
        margin: 0.75rem;
    }
}
/* Subscription Page Styles */
.subscription-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.trial-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.trial-banner.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

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

.trial-icon {
    font-size: 3rem;
}

.trial-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.trial-info p {
    margin: 0.25rem 0;
}

.trial-date {
    opacity: 0.9;
    font-size: 0.9rem;
}

.upgrade-now-btn {
    margin-left: auto;
    padding: 1rem 2rem;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    white-space: nowrap;
}

.upgrade-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.usage-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
}

.warning-icon {
    font-size: 2rem;
}

.warning-content h3 {
    margin: 0 0 0.5rem 0;
    color: #92400e;
}

.warning-content p {
    margin: 0;
    color: #78350f;
}

.subscription-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.subscription-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.subscription-card .card-header {
    background: #f9fafb;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subscription-card .card-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.subscription-card .card-body {
    padding: 1.5rem;
}

.plan-details {
    margin-bottom: 1.5rem;
}

.plan-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.plan-price .price {
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
}

.plan-price .period {
    color: #6b7280;
    font-size: 1rem;
}

.billing-info {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.billing-label {
    color: #6b7280;
}

.billing-date {
    font-weight: 600;
    color: #1f2937;
}

.plan-features {
    margin: 1.5rem 0;
}

.plan-features h4 {
    margin: 0 0 1rem 0;
    color: #4b5563;
    font-size: 1rem;
}

.plan-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plan-features li {
    padding: 0.5rem 0;
    color: #1f2937;
}

.reset-date {
    color: #6b7280;
    font-size: 0.875rem;
}

.usage-metric {
    margin-bottom: 1.5rem;
}

.usage-metric:last-child {
    margin-bottom: 0;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-weight: 600;
    color: #4b5563;
}

.metric-value {
    font-weight: 600;
    color: #1f2937;
}

.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.progress-fill.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.metric-percentage {
    font-size: 0.875rem;
    color: #6b7280;
}

.available-plans {
    margin-top: 3rem;
}

.available-plans h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.plans-subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.plan-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.plan-card.current {
    border-color: #10b981;
    background: #f0fdf4;
}

.current-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #10b981;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.plan-card .plan-header h3 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
}

.plan-card .plan-price {
    margin-bottom: 1rem;
}

.plan-description {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.plan-limits {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.limit-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.limit-icon {
    font-size: 1.25rem;
}

.limit-text {
    color: #4b5563;
}

.plan-card .plan-features ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}

.plan-card .plan-features li {
    padding: 0.5rem 0;
    color: #1f2937;
}

.plan-card .btn {
    width: 100%;
}
