/* FileIO Styles - Modern Enhanced UI */

/* === ROOT & VARIABLES === */
:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d29;
    --bg-tertiary: #23263a;
    --bg-hover: #2a2e44;
    --accent-primary: #5b8df6;
    --accent-hover: #4a7ce6;
    --accent-light: #6b9df8;
    --text-primary: #f5f6fa;
    --text-secondary: #b0b8c1;
    --text-muted: #7d8695;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #06b6d4;
    --border: #2d3142;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* === BASE === */
body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1d29 100%);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
}

/* === HERO SECTION === */
.fileio-hero {
    padding: 4rem 0 3rem;
    text-align: center;
}

.fileio-hero h1 {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* === LOGIN === */
.fileio-login {
    max-width: 420px;
    margin: 2rem auto;
}

/* === CARDS === */
.fileio-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fileio-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.card-body {
    padding: 2rem;
}

/* === NAVBAR === */
.fileio-navbar {
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border);
    padding: 1rem 1.5rem !important;
    margin-bottom: 2rem !important;
}

.fileio-logo {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fileio-user {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === TABLE === */
.fileio-table {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.fileio-table th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.fileio-table td {
    vertical-align: middle;
    color: var(--text-primary);
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.fileio-table tbody tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.fileio-table tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

.fileio-table tbody tr:last-child td {
    border-bottom: none;
}

.fileio-fname-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.fileio-fname-wrapper i {
    font-size: 1.25rem;
}

/* === BUTTONS === */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 0.875rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.fileio-btn {
    min-width: 100px;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(91, 141, 246, 0.3);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent-primary) 100%);
    box-shadow: 0 6px 16px rgba(91, 141, 246, 0.4);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: var(--success-hover);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.btn-info:hover {
    background: #0891b2;
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger-hover);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    color: white;
}

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

.btn-outline-light:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-outline-secondary,
.btn-outline-primary {
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

/* === ACTION BUTTONS === */
.fileio-action-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fileio-action-group .btn {
    margin-right: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0.5rem;
}

.fileio-action-group a.btn,
.fileio-action-group button.btn {
    display: inline-flex !important;
}

/* === FORMS === */
.form-control,
.form-select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.625rem 1rem;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(91, 141, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

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

/* === SEARCH === */
.fileio-search {
    max-width: 350px;
}

.fileio-search input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.fileio-search input:focus {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(91, 141, 246, 0.1);
}

/* === MODALS === */
.modal-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
}

.btn-close {
    filter: invert(1);
    opacity: 0.6;
}

.btn-close:hover {
    opacity: 1;
}

/* === MESSAGES === */
.fileio-action-msg {
    color: var(--accent-primary);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(91, 141, 246, 0.1);
    border: 1px solid rgba(91, 141, 246, 0.2);
}

.alert {
    border-radius: 8px;
    border: none;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* === SPINNER === */
.fileio-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-border.text-accent {
    color: var(--accent-primary) !important;
    width: 3rem;
    height: 3rem;
}

/* === DRAG & DROP === */
.fileio-dragover {
    box-shadow: 0 0 0 4px rgba(91, 141, 246, 0.3) !important;
    border: 2px dashed var(--accent-primary) !important;
    background: rgba(91, 141, 246, 0.05) !important;
}

/* === FOOTER === */
.fileio-footer {
    text-align: center;
    color: var(--text-muted);
    margin-top: 4rem;
    padding: 2rem 0;
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

/* === PROGRESS BAR === */
.progress {
    background: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-light) 100%);
    transition: width 0.3s ease;
}

/* === UTILITIES === */
.text-secondary {
    color: var(--text-secondary) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-info {
    color: var(--info) !important;
}

/* === RESPONSIVE === */

/* Tablet and below */
@media (max-width: 992px) {

    .fileio-table th:nth-child(3),
    .fileio-table td:nth-child(3) {
        display: none;
        /* Hide Size column */
    }
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .fileio-card {
        padding: 0.25rem;
        border-radius: 12px;
    }

    .card-body {
        padding: 1rem;
    }

    .fileio-table th:nth-child(2),
    .fileio-table td:nth-child(2),
    .fileio-table th:nth-child(4),
    .fileio-table td:nth-child(4) {
        display: none;
        /* Hide Type and Modified columns */
    }

    .fileio-table th,
    .fileio-table td {
        font-size: 0.875rem;
        padding: 0.75rem 0.5rem;
    }

    .fileio-navbar {
        padding: 0.75rem 1rem !important;
        border-radius: 8px;
    }

    .fileio-navbar .container-fluid {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .fileio-user {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
        font-size: 0.85rem;
    }

    .fileio-btn {
        min-width: auto;
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    .fileio-action-group {
        gap: 0.25rem;
    }

    .fileio-action-group .btn {
        min-width: 36px;
        min-height: 36px;
        padding: 0.4rem;
    }

    .fileio-logo {
        font-size: 1.4rem;
    }

    .fileio-fname-wrapper {
        gap: 0.5rem;
    }

    .fileio-fname-wrapper i {
        font-size: 1.1rem;
    }

    .fileio-search {
        max-width: 100% !important;
    }

    /* Stack buttons on mobile */
    .d-flex.gap-2.flex-wrap {
        justify-content: center;
    }

    .d-flex.gap-2.flex-wrap .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 100px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .card-body {
        padding: 0.75rem;
    }

    .fileio-table th,
    .fileio-table td {
        font-size: 0.8rem;
        padding: 0.6rem 0.4rem;
    }

    .fileio-action-group .btn {
        min-width: 32px;
        min-height: 32px;
        padding: 0.3rem;
        font-size: 0.75rem;
    }

    .fileio-fname-wrapper .fname-text {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fileio-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
    }

    .fileio-logo {
        font-size: 1.2rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body,
    .modal-header,
    .modal-footer {
        padding: 1rem;
    }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fileio-table tbody tr {
    animation: fadeIn 0.3s ease-out;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}
/* === TEXT EDITOR MODAL === */
#editorModal .modal-dialog {
    max-width: 95%;
    width: 95%;
}

#editorModal .modal-content {
    height: 90vh;
    display: flex;
    flex-direction: column;
}

#editorModal .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

/* CodeMirror styling */
.CodeMirror {
    height: 100% !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    border: none;
}

.CodeMirror-gutters {
    background: var(--bg-primary) !important;
    border-right: 1px solid var(--border) !important;
}

.CodeMirror-linenumber {
    color: var(--text-muted) !important;
}

/* Dracula theme override for better integration */
.cm-s-dracula.CodeMirror {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.cm-s-dracula .CodeMirror-cursor {
    border-left-color: var(--accent-primary) !important;
}

.cm-s-dracula .CodeMirror-selected {
    background: rgba(91, 141, 246, 0.2) !important;
}

.cm-s-dracula .CodeMirror-activeline-background {
    background: rgba(91, 141, 246, 0.05) !important;
}

/* Green button for edit */
.btn-outline-success {
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--success);
}

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

@media (max-width: 768px) {
    #editorModal .modal-dialog {
        max-width: 100%;
        width: 100%;
        margin: 0;
    }
    
    #editorModal .modal-content {
        height: 100vh;
        border-radius: 0;
    }
    
    .CodeMirror {
        font-size: 13px;
    }
}
