* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f1419;
    color: #e0e0e0;
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 20, 25, 0.95);
    border-right: 1px solid rgba(66, 153, 225, 0.3);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(66, 153, 225, 0.2);
}

.sidebar-header h2 {
    color: #4299e1;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-header p {
    color: #94a3b8;
    font-size: 0.85rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(66, 153, 225, 0.1);
    color: #4299e1;
}

.nav-item.active {
    background: rgba(66, 153, 225, 0.15);
    color: #4299e1;
    border-left-color: #4299e1;
}


.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(66, 153, 225, 0.2);
}

.user-info {
    margin-bottom: 1rem;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.btn-logout {
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(66, 153, 225, 0.2);
}

.content-header h1 {
    color: #e0e0e0;
    font-size: 2rem;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: #4299e1;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stat-info h3 {
    font-size: 2rem;
    color: #4299e1;
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    color: #e0e0e0;
    font-size: 1.5rem;
}

/* Data List */
.data-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Games List - Side by Side Grid */
#games-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.data-item {
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.data-item:hover {
    border-color: #4299e1;
    background: rgba(15, 20, 25, 0.8);
}

.data-item-info h3 {
    color: #e0e0e0;
    margin-bottom: 0.5rem;
}

.data-item-info p {
    color: #94a3b8;
    font-size: 0.9rem;
}

.data-item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit, .btn-delete {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-edit {
    background: rgba(66, 153, 225, 0.2);
    color: #4299e1;
    border: 1px solid rgba(66, 153, 225, 0.3);
}

.btn-edit:hover {
    background: rgba(66, 153, 225, 0.3);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 20, 25, 0.98);
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 12px;
    width: 95%;
    max-width: min(1400px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: block;
}

.modal-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(66, 153, 225, 0.2);
}

.modal-header h2 {
    color: #e0e0e0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Form */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    min-width: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    background: rgba(15, 20, 25, 0.8);
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

/* Rich Text Editor */
.rich-text-editor-wrapper {
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 6px;
    background: rgba(15, 20, 25, 0.8);
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rich-text-editor-wrapper:focus-within {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.rich-text-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(15, 20, 25, 0.6);
    border-bottom: 1px solid rgba(66, 153, 225, 0.2);
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 0.5rem 0.75rem;
    background: rgba(66, 153, 225, 0.1);
    border: 1px solid rgba(66, 153, 225, 0.2);
    border-radius: 4px;
    color: #4299e1;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.toolbar-btn:hover {
    background: rgba(66, 153, 225, 0.2);
    border-color: #4299e1;
}

.toolbar-btn:active {
    background: rgba(66, 153, 225, 0.3);
    transform: scale(0.95);
}

.toolbar-btn strong,
.toolbar-btn em,
.toolbar-btn u {
    font-weight: bold;
    font-style: normal;
    text-decoration: none;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(66, 153, 225, 0.3);
    margin: 0 0.25rem;
}

.toolbar-select {
    padding: 0.4rem 0.5rem;
    background: rgba(66, 153, 225, 0.1);
    border: 1px solid rgba(66, 153, 225, 0.2);
    border-radius: 4px;
    color: #4299e1;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    min-width: 70px;
    height: 32px;
    outline: none;
}

.toolbar-select:hover {
    background: rgba(66, 153, 225, 0.2);
    border-color: #4299e1;
}

.toolbar-select:focus {
    background: rgba(66, 153, 225, 0.2);
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.2);
}

.toolbar-select option {
    background: rgba(15, 20, 25, 0.98);
    color: #e0e0e0;
}

.rich-text-editor {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    color: #e0e0e0;
    font-size: 1rem;
    line-height: 1.6;
    outline: none;
    font-family: inherit;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
}

.rich-text-editor:empty:before {
    content: attr(data-placeholder);
    color: #64748b;
}

.rich-text-editor p {
    margin: 0.5rem 0;
}

.rich-text-editor p:first-child {
    margin-top: 0;
}

.rich-text-editor p:last-child {
    margin-bottom: 0;
}

.rich-text-editor h2 {
    color: #4299e1;
    font-size: 1.5rem;
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
}

.rich-text-editor h3 {
    color: #63b3ed;
    font-size: 1.25rem;
    margin: 0.75rem 0 0.5rem 0;
    font-weight: 600;
}

.rich-text-editor ul,
.rich-text-editor ol {
    margin: 0.5rem 0;
    padding-left: 2rem;
}

.rich-text-editor li {
    margin: 0.25rem 0;
}

.rich-text-editor a {
    color: #4299e1;
    text-decoration: underline;
}

.rich-text-editor a:hover {
    color: #63b3ed;
}

.rich-text-editor.drag-over-editor {
    background: rgba(66, 153, 225, 0.1);
    border-color: #4299e1;
    border-style: dashed;
    border-width: 2px;
    outline: 2px solid rgba(66, 153, 225, 0.3);
    outline-offset: 2px;
}


/* Draggable images in rich text editor */
.rich-text-editor img.draggable-image {
    cursor: move;
    transition: opacity 0.2s;
    position: relative;
}

.rich-text-editor img.draggable-image:hover {
    opacity: 0.9;
    outline: 2px solid rgba(66, 153, 225, 0.5);
    outline-offset: 4px;
}

.rich-text-editor img.dragging-image {
    opacity: 0.5;
    cursor: grabbing;
}

.image-wrapper.dragging {
    opacity: 0.5;
    cursor: grabbing !important;
}

.image-wrapper[draggable="true"] {
    cursor: move;
}

.drop-indicator {
    box-shadow: 0 0 8px rgba(66, 153, 225, 0.6);
}

/* Image wrapper with delete button */
.image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    margin: 1rem 0;
}

.image-wrapper:hover .image-delete-btn,
.rich-text-editor .image-wrapper:hover .image-delete-btn {
    opacity: 1 !important;
    visibility: visible !important;
}

.image-delete-btn {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
    background: rgba(239, 68, 68, 0.9) !important;
    border: 2px solid #fff !important;
    border-radius: 50% !important;
    color: #fff !important;
    font-size: 20px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: visible !important;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10000 !important;
    line-height: 1 !important;
    padding: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    pointer-events: auto !important;
}

.rich-text-editor .image-wrapper {
    position: relative !important;
    display: inline-block !important;
    width: 100% !important;
    margin: 1rem 0 !important;
}

.rich-text-editor .image-wrapper .image-delete-btn {
    opacity: 0;
}

.rich-text-editor .image-wrapper:hover .image-delete-btn {
    opacity: 1 !important;
    visibility: visible !important;
}

.image-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.image-delete-btn:active {
    transform: scale(0.95);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(66, 153, 225, 0.2);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 6px;
    color: #4299e1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(66, 153, 225, 0.1);
    border-color: #4299e1;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    #games-list {
        grid-template-columns: 1fr;
    }
}

/* Permissions Grid */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(15, 20, 25, 0.4);
    border: 1px solid rgba(66, 153, 225, 0.2);
    border-radius: 8px;
}

.permission-group {
    margin-bottom: 1rem;
}

.permission-group h4 {
    margin-bottom: 0.5rem;
    color: #e0e0e0;
    font-size: 0.95rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(66, 153, 225, 0.2);
}

.permission-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin: 0.25rem 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.permission-checkbox:hover {
    background: rgba(66, 153, 225, 0.1);
}

.permission-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4299e1;
}

.permission-checkbox span {
    color: #94a3b8;
    font-size: 0.9rem;
    user-select: none;
}

.permission-checkbox input[type="checkbox"]:checked + span {
    color: #e0e0e0;
}

/* Team Grouping for Players */
.team-group {
    margin-bottom: 1.5rem;
    background: rgba(15, 20, 25, 0.4);
    border: 1px solid rgba(66, 153, 225, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.team-group-header {
    padding: 1rem 1.5rem;
    background: rgba(66, 153, 225, 0.1);
    border-bottom: 1px solid rgba(66, 153, 225, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.team-group-header:hover {
    background: rgba(66, 153, 225, 0.15);
}

.team-group-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.team-group-icon {
    color: #4299e1;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    user-select: none;
    min-width: 12px;
}

.team-group-title h3 {
    color: #4299e1;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.team-group-count {
    color: #94a3b8;
    font-size: 0.9rem;
    background: rgba(66, 153, 225, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.team-group-players {
    padding: 0.5rem;
    display: block;
}

.team-group-players .data-item {
    margin: 0.5rem;
    background: rgba(15, 20, 25, 0.8);
}

/* Media Context Menu Styles */
#media-context-menu .context-menu-item {
    transition: background 0.2s;
}

#media-context-menu .context-menu-item:hover {
    background: rgba(66, 153, 225, 0.2);
}

#media-context-menu .context-menu-item:active {
    background: rgba(66, 153, 225, 0.3);
}

/* Drag and Drop Styles */
#media-grid [draggable="true"] {
    cursor: move;
}

#media-grid .dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

#media-grid .drag-over {
    border-color: #fbbf24 !important;
    border-width: 3px !important;
    transform: scale(1.1);
}

/* Folder drop zone styling */
#media-grid [data-file-type="folder"].drag-over {
    border-color: #10b981 !important;
    border-width: 3px !important;
    transform: scale(1.1);
    background: rgba(16, 185, 129, 0.1);
}

/* Custom Notification Toast */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10001;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.notification-toast.show {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

.notification-toast.success {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(15, 23, 42, 0.98);
}

.notification-toast.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(15, 23, 42, 0.98);
}

.notification-toast.info {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(15, 23, 42, 0.98);
}

.notification-toast.warning {
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(15, 23, 42, 0.98);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notification-toast.success .notification-icon::before {
    content: '✓';
    color: #10b981;
}

.notification-toast.error .notification-icon::before {
    content: '✕';
    color: #ef4444;
}

.notification-toast.info .notification-icon::before {
    content: 'ℹ';
    color: #3b82f6;
}

.notification-toast.warning .notification-icon::before {
    content: '⚠';
    color: #fbbf24;
}

.notification-message {
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.5;
    flex: 1;
}

/* Custom Dialog (Confirmation & Prompt) */
.custom-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    backdrop-filter: blur(4px);
}

/* Prevent clicks on custom dialog from closing parent modals */
.custom-dialog-content {
    pointer-events: auto;
}

.custom-dialog.show {
    display: flex;
}

.custom-dialog-content {
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 12px;
    min-width: 400px;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: dialogSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

@keyframes dialogSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.custom-dialog-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(66, 153, 225, 0.2);
}

.custom-dialog-title {
    color: #4299e1;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.custom-dialog-body {
    padding: 1.5rem;
}

.custom-dialog-message {
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 1rem 0;
    white-space: pre-line;
}

.custom-dialog-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 20, 25, 0.8);
    border: 1px solid rgba(66, 153, 225, 0.3);
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.custom-dialog-input:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.custom-dialog-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(66, 153, 225, 0.2);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.custom-dialog-actions .btn-secondary,
.custom-dialog-actions .btn-primary {
    min-width: 100px;
}
