/* Variables CSS */
:root {
    --primary: #17397A;
    --secondary: #22C55E;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #f5f7fa;
    --dark: #2c3e50;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #1e4d9b 100%);
    color: white;
    padding: 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 5px;
    font-weight: 700;
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

/* Commercial Info */
.commercial-info {
    background: rgba(255,255,255,0.1);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.5s ease;
}

.commercial-avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: white;
}

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

/* Form Section */
.form-section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 25px;
    animation: fadeInUp 0.6s ease;
}

.form-section h2 {
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light);
    font-size: 1.5rem;
}

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    padding: 12px 15px;
    border: 2px solid var(--light);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
    transform: translateY(-1px);
}

.form-control[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.form-control:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

select.form-control {
    cursor: pointer;
}

/* Folder Name Preview */
.folder-name-preview {
    background: var(--light);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border: 2px solid var(--secondary);
}

.folder-name-preview label {
    font-weight: 600;
    color: var(--primary);
    display: block;
    margin-bottom: 10px;
}

.folder-name-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--secondary);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--dark);
    background: white;
}

/* Navigation Path */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    white-space: nowrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    padding: 5px 10px;
    border-radius: 6px;
}

.breadcrumb-item:hover {
    color: var(--secondary);
    background: rgba(34, 197, 94, 0.1);
}

.breadcrumb-separator {
    color: #999;
    margin: 0 5px;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    touch-action: manipulation;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--dark);
    border: 2px solid var(--light);
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    transform: translateY(-2px);
}

.btn-confirm {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 20px;
    font-size: 18px;
    padding: 15px 30px;
}

.btn-confirm:hover {
    background: #1e4d9b;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(23, 57, 122, 0.3);
}

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

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

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.file-item {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    animation: fadeInScale 0.5s ease;
}

.file-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.file-item.folder {
    border-left: 4px solid var(--primary);
}

.file-item.file {
    border-left: 4px solid var(--secondary);
}

.file-preview {
    height: 150px;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--primary);
    position: relative;
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.file-item:hover .file-preview img {
    transform: scale(1.05);
}

.file-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-info {
    padding: 15px;
}

.file-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: none;
    gap: 5px;
}

.file-item:hover .file-actions {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.action-btn {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.action-btn:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transform: scale(1.1);
}

/* Upload Modal */
.upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.upload-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.upload-content {
    background: white;
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease;
}

.upload-header {
    padding: 20px;
    border-bottom: 1px solid var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--light);
}

.upload-header h3 {
    color: var(--primary);
    margin: 0;
}

.upload-body {
    padding: 20px;
}

.upload-area {
    border: 3px dashed var(--secondary);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: rgba(34, 197, 94, 0.05);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(34, 197, 94, 0.1);
    transform: scale(1.02);
}

.upload-area.dragging {
    border-color: var(--secondary);
    background: rgba(34, 197, 94, 0.2);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

.upload-list {
    margin-top: 20px;
}

.upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
    margin-bottom: 10px;
    animation: slideInLeft 0.3s ease;
}

.upload-progress {
    width: 100%;
    height: 4px;
    background: var(--light);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.upload-progress-bar {
    height: 100%;
    background: var(--secondary);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Viewer Modal */
.viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.viewer-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.viewer-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.viewer-content img,
.viewer-content video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
}

.viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.viewer-close:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.viewer-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.loading-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
}

.spinner-large {
    width: 60px;
    height: 60px;
    border: 6px solid var(--light);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

/* Success Message */
.success-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--secondary);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    display: none;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    z-index: 2000;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

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

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideInLeft {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .header h1 {
        font-size: 20px;
    }

    .container {
        padding: 15px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .file-preview {
        height: 120px;
        font-size: 36px;
    }

    .action-bar {
        flex-direction: column;
    }

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

    .upload-content {
        margin: 10px;
        max-height: 95vh;
    }

    .viewer-content {
        max-width: 95vw;
        max-height: 95vh;
    }

    .breadcrumb {
        padding: 10px;
        font-size: 14px;
    }

    .commercial-info {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .form-section {
        padding: 15px;
    }

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

    .file-preview {
        height: 100px;
        font-size: 24px;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-icon {
        font-size: 36px;
    }
}

/* Print styles */
@media print {
    .header,
    .action-bar,
    .upload-modal,
    .viewer-modal,
    .success-message,
    .loading-overlay {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .file-grid {
        display: block;
    }
    
    .file-item {
        break-inside: avoid;
        margin-bottom: 10px;
    }
}