/* Media Management System - Metronic 8 Inspired Design */

:root {
    --primary: #009EF7;
    --success: #50CD89;
    --info: #7239EA;
    --warning: #FFC700;
    --danger: #F1416C;
    --dark: #181C32;
    --light: #F5F8FA;
    --gray-100: #F9F9F9;
    --gray-200: #EFF2F5;
    --gray-300: #E4E6EF;
    --gray-400: #B5B5C3;
    --gray-500: #A1A5B7;
    --gray-600: #7E8299;
    --gray-700: #5E6278;
    --gray-800: #3F4254;
    --gray-900: #181C32;
}

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

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    background-color: var(--light);
    color: var(--gray-800);
    line-height: 1.6;
}

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

.text-center { text-align: center; }
.text-start { text-align: right; }
.text-end { text-align: left; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Cards */
.card {
    background: white;
    border-radius: 0.625rem;
    box-shadow: 0 0 20px 0 rgba(76, 87, 125, 0.02);
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-200);
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.card-body {
    padding: 2rem;
}

.card-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--gray-200);
    background-color: var(--gray-100);
    border-radius: 0 0 0.625rem 0.625rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.475rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.btn-primary:hover {
    background-color: #0095e8;
}

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

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

.btn-light {
    background-color: var(--gray-200);
    color: var(--gray-800);
}

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.475rem;
    background-color: white;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 158, 247, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.475rem;
    background-color: white;
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table thead {
    background-color: var(--gray-100);
}

.table th {
    padding: 1rem;
    text-align: right;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
    background-color: var(--gray-100);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.425rem;
    text-transform: uppercase;
}

.badge-success {
    background-color: #E8FFF3;
    color: var(--success);
}

.badge-danger {
    background-color: #FFF5F8;
    color: var(--danger);
}

.badge-primary {
    background-color: #F1FAFF;
    color: var(--primary);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.475rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #E8FFF3;
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background-color: #FFF5F8;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background-color: #F1FAFF;
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7239EA 100%);
}

.login-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--gray-600);
    font-size: 0.95rem;
}

/* Sidebar */
.sidebar {
    width: 265px;
    background-color: var(--dark);
    min-height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo h2 {
    color: white;
    font-size: 1.5rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 0;
}

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

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--gray-400);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-menu a.active {
    border-right: 3px solid var(--primary);
}

.sidebar-menu-icon {
    margin-left: 0.75rem;
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    margin-right: 265px;
    padding: 2rem;
    min-height: 100vh;
}

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

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--gray-600);
    font-size: 0.95rem;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background: white;
    border-radius: 0.625rem;
    overflow: hidden;
    box-shadow: 0 0 20px 0 rgba(76, 87, 125, 0.02);
    border: 1px solid var(--gray-200);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.gallery-item-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-item-content {
    padding: 1.5rem;
}

.gallery-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.gallery-item-description {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.gallery-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.media-item {
    position: relative;
    border-radius: 0.475rem;
    overflow: hidden;
    aspect-ratio: 1;
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.media-item:hover .media-item-overlay {
    opacity: 1;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(100%);
        z-index: 1000;
    }

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

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

@media (max-width: 767px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

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

    .login-card {
        padding: 2rem;
    }
}
