/* WulfVault - Secure File Transfer System
 * Copyright (c) 2025 Ulf Holmström (Frimurare)
 * Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0)
 * You must retain this notice in any copy or derivative work.
 */

:root {
    --primary-color: #0066CC;
    --secondary-color: #333333;
    --background: #f5f5f5;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
}

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

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

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

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    opacity: 0.9;
}

.card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 24px;
}

.upload-progress {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: #28a745;
}

.toast-error {
    background: #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* File upload progress container */
.upload-progress-container {
    text-align: center;
}

.upload-progress-container p {
    margin-bottom: 16px;
    color: #333;
    font-weight: 500;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Hamburger Menu Button */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    z-index: 1001;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: white;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

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

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

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

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999;
}

.mobile-nav-overlay.active {
    display: block;
}

/* ============================================
   TABLET & MOBILE BREAKPOINTS (< 768px)
   ============================================ */

@media screen and (max-width: 768px) {
    /* Header Adjustments */
    .header {
        padding: 15px 20px !important;
        flex-wrap: wrap;
    }

    .header .logo h1 {
        font-size: 18px !important;
    }

    .header .logo img {
        max-height: 40px !important;
        max-width: 120px !important;
    }

    /* Show Hamburger Menu */
    .hamburger {
        display: flex !important;
        order: 3;
    }

    /* Hide Desktop Navigation */
    .header nav {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 280px !important;
        height: 100vh !important;
        background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 80px 30px 30px !important;
        gap: 0 !important;
        transition: right 0.3s ease !important;
        z-index: 1000 !important;
        overflow-y: auto !important;
        box-shadow: -5px 0 15px rgba(0,0,0,0.3) !important;
    }

    .header nav.active {
        display: flex !important;
        right: 0 !important;
    }

    .header nav a {
        width: 100%;
        padding: 15px 20px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 16px !important;
        margin: 0 !important;
    }

    .header nav a:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Container Padding */
    .container {
        padding: 0 15px !important;
        margin: 20px auto !important;
    }

    /* Stats Grid - Single Column on Small Screens */
    .stats {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        margin-bottom: 30px !important;
    }

    /* Stat Cards - Compact for Mobile */
    .stat-card {
        padding: 20px !important;
    }

    .stat-card .value {
        font-size: 28px !important;
    }

    .stat-card h3 {
        font-size: 12px !important;
    }

    /* Buttons - Larger Touch Targets */
    .btn {
        padding: 12px 24px !important;
        font-size: 15px !important;
        min-height: 44px;
        min-width: 44px;
    }

    /* Tables - Convert to Card Layout on Mobile */
    table {
        display: block;
        overflow-x: auto;
    }

    thead {
        display: none;
    }

    tbody {
        display: block;
    }

    tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px;
        padding: 15px;
        background: white;
    }

    td {
        display: block;
        text-align: left !important;
        padding: 8px 0 !important;
        border: none !important;
    }

    /* Add labels to table data on mobile */
    td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        display: inline-block;
        width: 120px;
        margin-right: 10px;
    }

    td:empty {
        display: none;
    }

    /* Action Links/Buttons in Tables */
    .action-links,
    .action-links a,
    .action-links button {
        display: block !important;
        width: 100% !important;
        margin: 5px 0 !important;
        text-align: center !important;
    }

    /* Actions Bar */
    .actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px;
    }

    .actions h2 {
        margin-bottom: 0 !important;
    }

    .actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Upload Zone */
    .upload-zone {
        padding: 40px 15px !important;
    }

    .upload-zone h2 {
        font-size: 18px !important;
    }

    .upload-zone p {
        font-size: 14px !important;
    }

    .upload-zone svg {
        width: 48px !important;
        height: 48px !important;
    }

    /* Files Section */
    .files-section {
        border-radius: 8px !important;
    }

    .files-header {
        padding: 15px !important;
    }

    .files-header h2 {
        font-size: 18px !important;
    }

    /* File Items/Cards */
    .file-card,
    .file-item {
        padding: 15px !important;
        margin-bottom: 10px;
    }

    /* Modals - Full Screen on Mobile */
    .modal,
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        min-height: 100vh;
    }

    /* Forms - Stack Form Elements */
    form input,
    form select,
    form textarea,
    form button {
        width: 100% !important;
        margin-bottom: 15px;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    form label {
        display: block;
        margin-bottom: 5px;
        font-weight: 600;
    }

    /* Info Boxes */
    .info-box {
        padding: 12px !important;
        font-size: 14px !important;
    }

    /* Toast Notifications - Adjust for Mobile */
    .toast {
        right: 10px !important;
        left: 10px !important;
        top: 10px !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
    }

    /* Charts and Graphs - Make Scrollable */
    .chart-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Joke of the Day */
    .joke {
        padding: 15px !important;
        font-size: 14px !important;
    }

    /* Badge Adjustments */
    .badge {
        font-size: 11px !important;
        padding: 3px 8px !important;
    }

    /* Progress Bars */
    .progress {
        height: 8px !important;
    }

    /* Spacing Adjustments */
    h1 {
        font-size: 24px !important;
    }

    h2 {
        font-size: 20px !important;
    }

    h3 {
        font-size: 16px !important;
    }

    /* File List - Mobile Optimized */
    .file-list {
        display: block !important;
    }

    .file-list-item {
        display: block !important;
        padding: 15px !important;
        margin-bottom: 10px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
    }

    /* Team Cards */
    .team-card {
        margin-bottom: 15px !important;
    }

    /* Settings Sections */
    .settings-section {
        padding: 15px !important;
        margin-bottom: 15px;
    }
}

/* ============================================
   SMALL MOBILE PHONES (< 480px)
   ============================================ */

@media screen and (max-width: 480px) {
    .header .logo h1 {
        font-size: 16px !important;
    }

    .stat-card .value {
        font-size: 24px !important;
    }

    .stat-card {
        padding: 15px !important;
    }

    .btn {
        font-size: 14px !important;
        padding: 10px 20px !important;
    }

    .container {
        padding: 0 10px !important;
    }

    h1 {
        font-size: 20px !important;
    }

    h2 {
        font-size: 18px !important;
    }

    /* Even More Compact Tables */
    td:before {
        width: 100px;
        font-size: 13px;
    }

    tr {
        padding: 12px;
    }
}

/* ============================================
   LANDSCAPE MOBILE (up to 896px wide, max 428px height)
   ============================================ */

@media screen and (max-width: 896px) and (max-height: 428px) and (orientation: landscape) {
    .header nav {
        width: 250px;
        padding: 60px 20px 20px;
    }

    .header nav a {
        padding: 12px 15px !important;
        font-size: 14px !important;
    }

    .stat-card .value {
        font-size: 24px !important;
    }
}

/* ============================================
   TOUCH OPTIMIZATION
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .stat-card:hover {
        transform: none;
    }

    /* Larger checkbox and radio buttons */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
}
