:root {
    --primary: #002d5e;       /* Deep navy blue from logo */
    --primary-light: #598cb7;     /* Medium blue */
    --accent-green: #83b81a;
    --bg-light: #f4f7f9;
    --text-dark: #333;
    --sidebar-w: 260px;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
}

/* LOGIN */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #1a3a5a 100%);
}

.login-card {
    background: white;
    padding: 3.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.2);
}

.login-logo {
    width: 150px;
    margin-bottom: 2rem;
}

.error {
    background: #fee;
    color: #c00;
    padding: 0.8rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 2rem;
}

.alert-success {
    background: #dfd;
    color: #060;
}

/* SIDEBAR */
.cms-layout {
    display: flex;
    min-height: 100vh;
}

.cms-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.sidebar-header img {
    height: 40px;
}

.sidebar-header span {
    font-weight: 600;
    color: var(--primary);
}

.cms-sidebar nav {
    flex-grow: 1;
    padding: 1rem 0;
}

.cms-sidebar nav a {
    display: block;
    padding: 1rem 2rem;
    text-decoration: none;
    color: #666;
    transition: all 0.2s;
}

.cms-sidebar nav a:hover, .cms-sidebar nav a.active {
    background: var(--bg-light);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.nav-divider {
    height: 1px;
    background: #eee;
    margin: 1rem 0;
}

.logout {
    color: #c00 !important;
}

/* MAIN CONTENT */
.cms-main {
    flex-grow: 1;
    padding: 3rem;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.main-header h1 {
    font-size: 1.8rem;
    margin: 0;
}

/* DATA TABLE */
.data-table-wrapper {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1.2rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #fcfcfc;
    font-weight: 600;
}

/* FORM STYLES */
.editor-container {
    background: white;
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    box-sizing: border-box;
}

input[type="date"] {
    cursor: pointer;
    min-height: 44px;
}

.ck-editor__editable {
    min-height: 400px;
}

small {
    color: #666;
    font-size: 0.8rem;
}

textarea {
    height: 100px;
    resize: vertical;
}

/* BUTTONS */
.btn {
    padding: 0.8rem 1.8rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

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

.btn-login {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    padding: 1rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    opacity: 1;
}

.btn-login:hover {
    background: #003a7a;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    margin-right: 0.5rem;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2.5rem;
    border-radius: 15px;
    width: 90%;
    max-width: 950px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.5rem;
}

.close-modal {
    font-size: 2.5rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

.modal-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    text-align: right;
}

.rich-text-content h2, .rich-text-content h3 { color: var(--primary); margin-top: 1.5rem; margin-bottom: 1rem; }
.rich-text-content p { margin-bottom: 1.2rem; line-height: 1.7; }
.rich-text-content ul, .rich-text-content ol { margin-bottom: 1.2rem; padding-left: 2rem; }
.rich-text-content blockquote { border-left: 4px solid var(--primary); padding-left: 1.5rem; font-style: italic; color: #555; margin: 1.5rem 0; }

/* MEDIA GALLERY (Explorer Style) */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.media-item {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.media-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-light);
}

.media-item.selected {
    border-color: var(--accent-green);
    border-width: 2px;
    background: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(131, 184, 26, 0.2);
}

.media-item.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-green);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

.media-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.media-item:hover .media-thumb img {
    transform: scale(1.05);
}

.media-info {
    padding: 1rem;
    font-size: 0.85rem;
    color: #475569;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.media-item:hover .media-info {
    color: var(--primary);
    background: #f8fafc;
}

/* Scrollbar for Modal Content */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.btn-sidebar-secondary:hover {
    background-color: #f8fafc !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.spinner-small {
    width: 30px;
    height: 30px;
    border: 3px solid #cbd5e1;
    border-top: 3px solid var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-filter {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.btn-filter.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.draggable-row {
    transition: background 0.2s, opacity 0.2s;
}

.draggable-row.dragging {
    opacity: 0.5;
    background: #f8fafc !important;
    outline: 2px dashed var(--primary-light);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: none;
    z-index: 1000;
}

.draggable-row.dragging * {
    pointer-events: none; /* Prevents children from interfering with dragover targets */
}

.drag-handle {
    cursor: grab;
    transition: color 0.2s;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle:hover {
    color: var(--primary) !important;
}

.draggable-row.is-draft {
    opacity: 0.6;
    background: #fafafa;
}

.draggable-row.is-draft td {
    color: #94a3b8;
}

.badge-draft {
    background: #94a3b8;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes slideUp {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.drag-handle {
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: #10b981;
}

input:focus + .slider {
  box-shadow: 0 0 1px #10b981;
}

input:checked + .slider:before {
  transform: translateX(18px);
}

.slider.round {
  border-radius: 22px;
}

.slider.round:before {
  border-radius: 50%;
}

.draggable-row:hover .drag-handle {
    opacity: 1;
    color: var(--primary);
}
