/* ============================================
   MOBILE-FIRST DESIGN
   Base styles are for mobile (320px+)
   Media queries enhance for larger screens
   ============================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    color: #334155;
    font-size: 16px; /* Base font size for mobile */
}

/* Header Navigation */
.header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 20px;
    color: rgb(235, 104, 34);
    font-weight: 700;
}

/* Hamburger button - visible on mobile only */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 10;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #cbd5e1;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav {
    display: none;
    width: 100%;
    order: 3;
    margin: 0;
}

.nav.open {
    display: block;
    padding-bottom: 12px;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.nav-list li {
    margin: 0;
}

.nav-list a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
}

.nav-list a:hover {
    background: rgba(102, 126, 234, 0.15);
    color: white;
}

.nav-list a.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 14px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-weight: 500;
    display: none;
}

.logout-form {
    margin: 0;
}

.btn-logout {
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
}

/* Main Content Area - Mobile First */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

.page-header {
    padding: 24px 16px 16px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

.content-area {
    padding: 16px;
    max-width: 100%;
}

/* Alert Messages */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

/* Form Styles - Mobile First */
.form-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1;
}

.form-group label {
    display: block;
    color: #334155;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    transition: all 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.input-with-prefix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-prefix .prefix {
    position: absolute;
    left: 14px;
    color: #64748b;
    font-weight: 500;
}

.input-with-prefix input {
    padding-left: 32px;
}

.form-help {
    font-size: 13px;
    color: #64748b;
    margin-top: 6px;
}

/* Buttons - Mobile First (larger touch targets) */
.btn {
    padding: 14px 20px; /* Larger for mobile touch */
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    min-height: 44px; /* Minimum touch target size */
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #cbd5e1;
}

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

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

.form-actions {
    display: flex;
    flex-direction: column; /* Stack vertically on mobile */
    gap: 10px;
    margin-top: 20px;
    grid-column: 1;
}

.form-actions .btn {
    width: 100%; /* Full width on mobile */
}

/* Card Styles - Mobile First */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 16px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    flex-direction: column; /* Stack on mobile */
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

/* Table Styles - Mobile First (card-based for mobile) */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Hide certain columns on mobile */
.hide-mobile {
    display: none;
}

/* Mobile card view for table data */
.mobile-subscription-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.mobile-subscription-card .subscription-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.mobile-subscription-card .subscription-detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.mobile-subscription-card .subscription-detail:last-child {
    border-bottom: none;
}

.mobile-subscription-card .detail-label {
    color: #64748b;
    font-weight: 500;
}

.mobile-subscription-card .detail-value {
    color: #1e293b;
    text-align: right;
}

.mobile-subscription-card .table-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

thead {
    background: #f8fafc;
}

th {
    text-align: left;
    padding: 3px 8px;
    font-weight: 600;
    color: #475569;
    font-size: 14px;
    border-bottom: 2px solid #e2e8f0;
}

td {
    padding: 3px 8px;
    border-bottom: 1px solid #e2e8f0;
}

tr:hover {
    background: #f8fafc;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 14px;
    min-height: 36px;
}

.btn-light {
    display: inline-block;
    outline: 0;
    appearance: none;
    padding: 0 12px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    background-color: rgb(249, 251, 250);
    border: 1px solid rgb(137, 151, 155);
    box-shadow: rgb(6 22 33 / 30%) 0px 1px 2px;
    color: rgb(61, 79, 88);
    font-size: 14px;
    font-weight: 400;
    height: 36px;
    line-height: 36px;
    transition: all 150ms ease-in-out;
}

.btn-light:hover {
    color: rgb(61, 79, 88);
    background-color: rgb(255, 255, 255);
    border: 1px solid rgb(93, 108, 116);
    box-shadow: rgb(0 0 0 / 30%) 0px 4px 4px, rgb(231 238 236) 0px 0px 0px 3px;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

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

.badge-yearly {
    background: #d1fae5;
    color: #065f46;
}

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

/* ============================================
   TABLET BREAKPOINT (768px and up)
   ============================================ */
@media (min-width: 768px) {
    /* Hide hamburger on tablet+ */
    .hamburger {
        display: none;
    }

    /* Show nav horizontally on tablet+ */
    .nav {
        display: flex;
        flex: 1;
        margin: 0 20px;
        width: auto;
        order: 0;
    }

    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    /* Increase base font sizes */
    body {
        font-size: 15px;
    }

    /* Show hidden columns on tablet and up */
    .hide-mobile {
        display: table-cell;
    }

    table {
        font-size: 15px;
    }

    /* Form grid becomes 2 columns */
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .form-group.full-width {
        grid-column: 1 / -1;
    }

    /* Form container gets more padding */
    .form-container {
        padding: 28px;
        border-radius: 10px;
    }

    /* Content area gets more padding */
    .content-area {
        padding: 24px;
    }

    /* Cards get more padding */
    .card {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 10px;
    }

    /* Card headers can be horizontal */
    .card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    /* Top bar improvements */
    .top-bar {
        padding: 18px 24px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .page-title {
        font-size: 22px;
    }

    /* Button actions can be horizontal */
    .form-actions {
        flex-direction: row;
        margin-top: 24px;
        grid-column: 1 / -1;
    }

    .form-actions .btn {
        width: auto;
    }
}

/* ============================================
   DESKTOP BREAKPOINT (1024px and up)
   ============================================ */
@media (min-width: 1024px) {
    /* Logo and nav sizing */
    .logo h1 {
        font-size: 24px;
    }

    .nav {
        margin: 0 40px;
    }

    .nav-list {
        gap: 8px;
    }

    .nav-list a {
        padding: 10px 20px;
        font-size: 15px;
    }

    .header-actions {
        gap: 20px;
    }

    .user-name {
        display: inline;
    }

    /* Larger typography */
    .page-title {
        font-size: 28px;
    }

    .page-header {
        padding: 32px 32px 24px;
    }

    .card-title {
        font-size: 18px;
    }

    /* More generous spacing */
    .content-area {
        padding: 32px;
    }

    .form-container {
        padding: 32px;
        border-radius: 12px;
        max-width: 800px;
    }

    .card {
        padding: 24px;
        margin-bottom: 24px;
        border-radius: 12px;
    }
}

/* ============================================
   LARGE DESKTOP BREAKPOINT (1440px and up)
   ============================================ */
@media (min-width: 1440px) {
    /* Even more generous spacing for large screens */
    .content-area {
        padding: 40px;
    }

    .form-container {
        max-width: 900px;
    }
}
