/* MyHost - Student Hosting Portal Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --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);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

/* Generic logo image sizing */
.logo img { height: 36px; width: auto; display: block; }
/* Ensure header context always clamps the image size */
.header .logo img { height: 36px; max-height: 36px; width: auto; }

@media (max-width: 768px) {
    .header .logo img { height: 28px; max-height: 28px; }
}

.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Hamburger toggle hidden by default (desktop) */
.nav-toggle {
    display: none;
}

.nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--primary-color);
}

.nav a.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Disabled states for clarity */
.disabled-link {
    color: var(--text-secondary) !important;
    opacity: 0.6;
    cursor: not-allowed;
    text-decoration: none;
}
.disabled-link:hover {
    color: var(--text-secondary) !important;
}

.btn[disabled], .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* Keyboard focus visibility */
.btn:focus,
.nav a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

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

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Hero Section */
.hero {
    padding: 8rem 0 4rem;
    background: linear-gradient(135deg, var(--surface-color) 0%, var(--background-color) 100%);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.browser-mockup {
    background: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.browser-header {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.browser-buttons span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
}

.browser-buttons span:first-child {
    background: #ef4444;
}

.browser-buttons span:nth-child(2) {
    background: #f59e0b;
}

.browser-buttons span:last-child {
    background: #10b981;
}

.browser-url {
    background: var(--surface-color);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    flex: 1;
}

.browser-content {
    padding: 2rem;
    text-align: center;
}

.browser-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Features Section */
.features {
    padding: 4rem 0;
}

.features h2 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
}

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

.feature-card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
}

.feature-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-secondary);
}

/* Pricing Section */
.pricing {
    padding: 4rem 0;
    background: var(--surface-color);
}

.pricing h2 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
}

.pricing-card {
    max-width: 400px;
    margin: 0 auto;
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.price-header {
    background: var(--primary-color);
    color: white;
    padding: 2rem;
    text-align: center;
}

.price-header h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
}

.currency {
    font-size: 1.5rem;
}

.amount {
    font-size: 4rem;
    font-weight: 800;
}

.period {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
}

.features-list {
    padding: 2rem;
    list-style: none;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.features-list i {
    color: var(--success-color);
}

.pricing-card .btn {
    margin: 0 2rem 2rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    overflow-y: auto;
    padding: 1rem;
}

.modal-content {
    background: var(--surface-color);
    margin: 5% auto;
    padding: 0;
    border-radius: 0.5rem;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
    max-height: 85vh; /* keep within viewport */
    overflow: auto; /* scroll inside the modal */
    -webkit-overflow-scrolling: touch;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-primary);
}

.auth-form {
    padding: 2rem;
}

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

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    display: none;
}

.message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1rem;
}

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

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Hamburger toggle hidden on desktop; shown on mobile */
    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 1px solid var(--border-color);
        border-radius: 0.375rem;
        background: var(--surface-color);
        color: var(--text-primary);
        box-shadow: var(--shadow);
    }
    .nav-toggle i { font-size: 1.125rem; }

    .hero .container {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Header layout: allow wrapping and anchor absolute nav */
    .header .container {
        position: relative;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }
    /* Mobile nav: hidden by default; absolute dropdown under header */
    .nav {
        position: absolute;
        top: 100%;
        left: 1rem;
        right: 1rem;
        display: none;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 0.75rem 1rem;
        background: var(--surface-color);
        border: 1px solid var(--border-color);
        border-radius: 0.5rem;
        box-shadow: var(--shadow);
        animation: navDrop 0.2s ease;
    }
    .nav.open { display: flex !important; }
    @keyframes navDrop {
        from { opacity: 0; transform: translateY(-6px); }
        to { opacity: 1; transform: translateY(0); }
    }
    .logo {
        font-size: 1.25rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10% 1rem;
    }

    /* Prevent dashboard content from overlapping taller mobile header */
    .dashboard {
        margin-top: 120px;
    }
}

/* Dashboard Styles */
.dashboard {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

.dashboard-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.dashboard-header p {
    color: var(--text-secondary);
    margin: 0;
}

.dashboard-nav {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-nav a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.dashboard-nav a.active,
.dashboard-nav a:hover {
    background: var(--primary-color);
    color: white;
}

.dashboard-content {
    padding: 2rem 0;
}

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

.stat-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* Prevent long values/URLs from overflowing the card */
.stat-card .value,
.stat-card .value a {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere; /* modern, safest */
    word-break: break-word;  /* fallback */
}

.stat-card .value a {
    font-size: 1rem; /* card already smaller for URL */
    line-height: 1.4;
    display: inline-block;
}

@media (max-width: 768px) {
    .dashboard-header h1 { font-size: 1.5rem; }
    .stat-card .value { font-size: 1.5rem; }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

.progress-fill.warning {
    background: var(--warning-color);
}

.progress-fill.danger {
    background: var(--error-color);
}

.card {
    background: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-content {
    padding: 1.5rem;
}

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

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--background-color);
}

.table tr:hover {
    background: var(--background-color);
}

/* Ensure wide tables are scrollable on small screens */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

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

.badge.danger {
    background: #fef2f2;
    color: #dc2626;
}

.file-manager {
    display: grid;
    gap: 1.5rem;
}

.file-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.file-list {
    background: var(--surface-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.file-item:hover {
    background: var(--background-color);
}

.file-item:last-child {
    border-bottom: none;
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    margin-right: 1rem;
    font-size: 1.25rem;
}

.file-icon.html {
    background: #fef3c7;
    color: #92400e;
}

.file-icon.css {
    background: #dbeafe;
    color: #1d4ed8;
}

.file-icon.js {
    background: #fef2f2;
    color: #dc2626;
}

.file-icon.php {
    background: #f3e8ff;
    color: #7c3aed;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.file-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.5rem;
    width: auto;
    height: auto;
}

/* Loading States */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
