/**
 * Media Link Custom Theme
 * Premium design overriding Bootstrap defaults
 */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
    /* Brand Colors */
    --ml-primary: #667eea;
    --ml-primary-dark: #5a6fd6;
    --ml-secondary: #764ba2;
    --ml-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ml-gradient-hover: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);

    /* Dark Theme Colors */
    --ml-dark: #0a0a14;
    --ml-darker: #050508;
    --ml-dark-card: #12121e;
    --ml-dark-border: #1e1e2e;

    /* Light Theme Colors */
    --ml-light: #f8f9fc;
    --ml-light-card: #ffffff;
    --ml-light-border: #e5e7eb;

    /* Text Colors */
    --ml-text: #1f2937;
    --ml-text-muted: #6b7280;
    --ml-text-light: #9ca3af;

    /* Status Colors */
    --ml-success: #10b981;
    --ml-warning: #f59e0b;
    --ml-danger: #ef4444;
    --ml-info: #3b82f6;

    /* Shadows */
    --ml-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --ml-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ml-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --ml-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Border Radius */
    --ml-radius-sm: 6px;
    --ml-radius: 10px;
    --ml-radius-lg: 16px;
    --ml-radius-xl: 24px;

    /* Transitions */
    --ml-transition: all 0.2s ease;
    --ml-transition-slow: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ml-text);
    background-color: var(--ml-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--ml-text);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.text-gradient {
    background: var(--ml-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    padding: 1rem 0;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--ml-transition);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
}

.brand-text {
    background: var(--ml-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--ml-transition);
}

.navbar-nav .nav-link:hover {
    color: #fff;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: var(--ml-radius);
    transition: var(--ml-transition);
    border: none;
}

.btn-primary {
    background: var(--ml-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    background: var(--ml-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.btn-outline-primary:hover {
    background: var(--ml-gradient);
    border-color: transparent;
    color: #fff;
}

.btn-outline-warning {
    border: 2px solid #f59e0b;
    color: #f59e0b;
    background: transparent;
}

.btn-outline-warning:hover {
    background: #f59e0b;
    color: #fff;
}

.btn-outline-danger {
    border: 2px solid #ef4444;
    color: #ef4444;
    background: transparent;
}

.btn-outline-danger:hover {
    background: #ef4444;
    color: #fff;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--ml-light-card);
    border: 1px solid var(--ml-light-border);
    border-radius: var(--ml-radius-lg);
    box-shadow: var(--ml-shadow);
    transition: var(--ml-transition);
}

.card:hover {
    box-shadow: var(--ml-shadow-lg);
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   Forms
   ============================================ */
.form-control, .form-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--ml-light-border);
    border-radius: var(--ml-radius);
    font-size: 1rem;
    transition: var(--ml-transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--ml-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

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

/* ============================================
   Hero Section
   ============================================ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--ml-dark);
    overflow: hidden;
    padding-top: 80px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
    animation: heroGlow 8s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    color: #fff;
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.hero .lead {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    margin-bottom: 2rem;
    max-width: 600px;
}

@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .hero .lead { font-size: 1.1rem; }
}

/* ============================================
   Feature Sections
   ============================================ */
.section {
    padding: 6rem 0;
}

.section-dark {
    background: var(--ml-dark);
    color: #fff;
}

.section-dark h2,
.section-dark h3 {
    color: #fff;
}

.section-dark .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

.section-title {
    margin-bottom: 1rem;
}

.section-subtitle {
    color: var(--ml-text-muted);
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* Feature Cards */
.feature-card {
    padding: 2rem;
    text-align: center;
    background: var(--ml-light-card);
    border-radius: var(--ml-radius-lg);
    border: 1px solid var(--ml-light-border);
    transition: var(--ml-transition);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--ml-shadow-xl);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ml-gradient);
    border-radius: var(--ml-radius-lg);
    font-size: 1.75rem;
}

.section-dark .feature-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.section-dark .feature-card h4 {
    color: #fff;
}

.section-dark .feature-card p {
    color: rgba(255, 255, 255, 0.6);
}

/* How It Works */
.step-number {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ml-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    border-radius: 50%;
    margin-bottom: 1rem;
}

/* Pricing */
.pricing-card {
    padding: 2.5rem;
    background: var(--ml-light-card);
    border-radius: var(--ml-radius-xl);
    border: 1px solid var(--ml-light-border);
    text-align: center;
}

.pricing-card.featured {
    background: var(--ml-gradient);
    color: #fff;
    transform: scale(1.05);
    box-shadow: var(--ml-shadow-xl);
}

.pricing-card.featured h4,
.pricing-card.featured .price {
    color: #fff;
}

.price {
    font-size: 3rem;
    font-weight: 800;
    margin: 1rem 0;
}

.price span {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.7;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    background: var(--ml-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 4rem 0 2rem;
}

.footer-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--ml-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.site-footer h6 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 1rem;
}

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

.site-footer a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: var(--ml-transition);
}

.site-footer a:hover {
    color: #fff;
}

.site-footer hr {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   App Layout (Portal)
   ============================================ */
.app-layout {
    background: var(--ml-light);
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--ml-dark);
    padding: 1.5rem;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--ml-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    display: block;
    text-decoration: none;
}

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

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

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--ml-radius);
    transition: var(--ml-transition);
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--ml-gradient);
    color: #fff;
}

.sidebar-nav .nav-icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.sidebar-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.75rem;
    padding: 0 1rem;
}

.main-content {
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--ml-text-muted);
}

/* ============================================
   Dashboard Cards
   ============================================ */
.stat-card {
    background: var(--ml-light-card);
    border-radius: var(--ml-radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--ml-light-border);
}

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

.stat-label {
    color: var(--ml-text-muted);
    font-size: 0.875rem;
}

/* Device Cards */
.device-card {
    background: var(--ml-light-card);
    border-radius: var(--ml-radius-lg);
    border: 1px solid var(--ml-light-border);
    padding: 1.5rem;
    transition: var(--ml-transition);
}

.device-card:hover {
    box-shadow: var(--ml-shadow-lg);
}

.device-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.device-status.online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--ml-success);
}

.device-status.offline {
    background: rgba(107, 114, 128, 0.1);
    color: var(--ml-text-muted);
}

.device-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    background: currentColor;
}

/* ============================================
   Tables
   ============================================ */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom-width: 1px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ml-text-muted);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--ml-light-border);
}

/* ============================================
   Badges
   ============================================ */
.badge {
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    border-radius: var(--ml-radius-sm);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--ml-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--ml-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ml-danger);
}

.badge-secondary {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.badge-primary {
    background: rgba(102, 126, 234, 0.1);
    color: var(--ml-primary);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    border: none;
    border-radius: var(--ml-radius);
    padding: 1rem 1.25rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--ml-success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ml-danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--ml-warning);
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ml-dark);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(102, 126, 234, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(118, 75, 162, 0.2) 0%, transparent 50%);
}

.login-card {
    background: var(--ml-light-card);
    border-radius: var(--ml-radius-xl);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: var(--ml-shadow-xl);
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    background: var(--ml-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 2rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--ml-transition-slow);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* ============================================
   Utilities
   ============================================ */
.text-primary { color: var(--ml-primary) !important; }
.text-success { color: var(--ml-success) !important; }
.text-warning { color: var(--ml-warning) !important; }
.text-danger { color: var(--ml-danger) !important; }

.bg-gradient { background: var(--ml-gradient) !important; }

.rounded-lg { border-radius: var(--ml-radius-lg) !important; }
.rounded-xl { border-radius: var(--ml-radius-xl) !important; }

.shadow-lg { box-shadow: var(--ml-shadow-lg) !important; }
.shadow-xl { box-shadow: var(--ml-shadow-xl) !important; }

/* Code/Device IDs */
.code {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875em;
    background: rgba(102, 126, 234, 0.1);
    color: var(--ml-primary);
    padding: 0.125rem 0.375rem;
    border-radius: var(--ml-radius-sm);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--ml-text-light);
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--ml-text);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--ml-text-muted);
    margin-bottom: 1.5rem;
}
