/* ========================================
   MODERN SAAS PORTAL - COMPACT & BEAUTIFUL
   ======================================== */

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

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

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== HEADER ===== */
header {
    background: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Login Form */
.login-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.login-form input {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    width: 180px;
    transition: all 0.2s;
}

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

.login-form button {
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.login-form button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* User Info */
.user-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.welcome-msg {
    font-weight: 500;
    color: #1e293b;
}

.logout-btn {
    padding: 8px 16px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ===== MAIN CONTENT ===== */
.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e293b;
}

.section-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px 0;
    letter-spacing: -0.01em;
}

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

/* App Card */
.app-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #eaeef2;
    height: fit-content;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* App Header */
.app-header {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    padding: 24px;
    color: white;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.app-tagline {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 4px;
    font-style: italic;
}

.app-description {
    font-size: 13px;
    opacity: 0.8;
    line-height: 1.5;
}

/* App Body */
.app-body {
    padding: 24px;
}

/* Plans Container */
.plans-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Plan Card */
.plan-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
    background: white;
}

.plan-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

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

.plan-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.plan-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    flex: 2;
}

.plan-price {
    font-size: 18px;
    font-weight: 700;
    color: #2563eb;
    flex: 1;
    text-align: right;
}

.plan-duration {
    font-size: 13px;
    color: #64748b;
    flex: 1;
    text-align: left;
    padding-left: 8px;
}

/* Plan Features */
.plan-features {
    padding: 16px;
    min-height: 140px;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    font-size: 13px;
    color: #475569;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.feature-list li:last-child {
    border-bottom: none;
}

/* Plan Footer */
.plan-footer {
    padding: 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.active-badge {
    background: #10b981;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.days-badge {
    background: #e2e8f0;
    color: #475569;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Action Buttons */
.launch-btn, .subscribe-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 140px;
    text-align: center;
}

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

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

.subscribe-btn {
    background: #7c3aed;
    color: white;
}

.subscribe-btn:hover {
    background: #6d28d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.login-btn {
    width: 100%;
    padding: 10px;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.login-btn:hover {
    background: #475569;
    transform: translateY(-2px);
}

.disabled-btn {
    background: #cbd5e1;
    cursor: not-allowed;
    color: #64748b;
}

.disabled-btn:hover {
    transform: none;
    box-shadow: none;
}

/* Status Badges (legacy support) */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

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

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

.status-not-subscribed {
    background: #f1f5f9;
    color: #475569;
}

.days-left {
    font-size: 12px;
    color: #2563eb;
    font-weight: 500;
    margin-left: 8px;
}

/* Features List (legacy support) */
.features-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
}

.feature-item {
    font-size: 13px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 4px;
}

.feature-item::before {
    content: "✓";
    color: #2563eb;
    font-weight: 600;
}

.feature-item.premium {
    color: #7c3aed;
}

.feature-item.premium::before {
    content: "⭐";
    color: #f59e0b;
}

/* Device Management Section */
#deviceManagement {
    margin-top: 40px;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.device-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.device-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.device-icon {
    font-size: 24px;
}

.device-info {
    flex: 1;
}

.device-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.device-details {
    font-size: 12px;
    color: #64748b;
}

.current-badge {
    background: #2563eb;
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.device-meta {
    margin-bottom: 12px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px dashed #f1f5f9;
}

.meta-label {
    color: #64748b;
}

.meta-value {
    font-weight: 500;
    color: #1e293b;
}

.revoke-btn {
    width: 100%;
    padding: 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.error-message {
    text-align: center;
    padding: 20px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
    margin: 20px 0;
}

.login-prompt {
    text-align: center;
    padding: 40px;
    color: #64748b;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.app-card {
    animation: slideIn 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .auth-section {
        width: 100%;
        justify-content: center;
    }
    
    .login-form {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    
    .login-form input {
        width: 100%;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
    }
    
    .plan-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .plan-name, .plan-price, .plan-duration {
        flex: auto;
        text-align: left;
    }
    
    .plan-footer {
        flex-direction: column;
        gap: 12px;
    }
    
    .launch-btn, .subscribe-btn {
        width: 100%;
    }
    
    .features-list {
        grid-template-columns: 1fr;
    }
}

/* Portal Forms */

/* Compact Auth Section */
.auth-section {
    max-width: 350px;
    margin: 0 auto 20px auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.auth-header {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.auth-tabs {
    display: flex;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.auth-tab:hover {
    background: #e8e8e8;
}

.auth-tab.active {
    background: white;
    color: #4CAF50;
    border-bottom: 2px solid #4CAF50;
}

.auth-form {
    display: none;
    padding: 20px;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.form-hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remember-me input {
    width: auto;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
}

.auth-btn:hover {
    background-color: #45a049;
}

/* Still portal */

.plan-card.trial-ended {
    border: 1px solid #ff9800;
    background-color: #fff3e0;
    opacity: 0.9;
}

.trial-ended-message {
    color: #ff9800;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
}

.upgrade-btn {
    background-color: #ff9800;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
}

.upgrade-btn:hover {
    background-color: #f57c00;
}

.upgrade-btn-disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    padding: 10px 15px;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    width: 100%;
    cursor: not-allowed;
}
