/* ============================================================
   SAGEMÖP — Ana Stil Dosyası
   Sanal Gerçeklik Mikro-Öğretim Platformu
   ============================================================ */

/* ---- CSS Reset & Değişkenler ---- */
:root {
    /* Renkler */
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --primary-50: #E3F2FD;
    --primary-100: #BBDEFB;

    --secondary: #37474F;
    --secondary-dark: #263238;
    --secondary-light: #546E7A;

    --success: #2E7D32;
    --success-light: #E8F5E9;
    --error: #C62828;
    --error-light: #FFEBEE;
    --warning: #EF6C00;
    --warning-light: #FFF3E0;
    --info: #0277BD;
    --info-light: #E1F5FE;

    /* Tema Renkleri (Roller) */
    --theme-teacher: #1565C0;
    --theme-teacher-light: #E3F2FD;
    --theme-student: #2E7D32;
    --theme-student-light: #E8F5E9;
    --theme-observer: #EF6C00;
    --theme-observer-light: #FFF3E0;
    --theme-admin: #8E24AA;
    --theme-admin-light: #F3E5F5;

    /* Nötr Renkler */
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    --white: #FFFFFF;
    --black: #000000;

    /* Tipografi */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    /* Aralıklar */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Gölgeler */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.15);

    /* Kenar Yarıçapı */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Geçişler */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
    --transition-fast: all 0.15s ease;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --header-height: 64px;
    --content-max-width: 1200px;

    /* Z-index */
    --z-dropdown: 100;
    --z-sidebar: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-100);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

/* ---- Layout: Dashboard (Sidebar + Content) ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--secondary-dark);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition-slow);
}

.app-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-sm);
}

.app-content {
    flex: 1;
    padding: var(--space-6);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

.app-footer-bar {
    padding: var(--space-4) var(--space-6);
    text-align: center;
    color: var(--gray-500);
    font-size: var(--text-sm);
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

/* ---- Sidebar ---- */
.sidebar-logo {
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
}

.sidebar-logo h1 {
    font-size: var(--text-lg);
    color: var(--white);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) 0;
}

.sidebar-section {
    margin-bottom: var(--space-4);
}

.sidebar-section-title {
    padding: var(--space-2) var(--space-6);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    color: rgba(255,255,255,0.7);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.sidebar-link:hover {
    color: var(--white);
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}

.sidebar-link.active {
    color: var(--white);
    background: rgba(255,255,255,0.12);
    border-left-color: var(--primary-light);
}

.sidebar-link .icon {
    width: 20px;
    text-align: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.sidebar-user {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--text-xs);
    color: rgba(255,255,255,0.5);
}

/* ---- Header ---- */
.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: var(--text-2xl);
    color: var(--gray-700);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hamburger-btn:hover {
    background: var(--gray-100);
}

.header-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-800);
}

.role-selector {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.role-selector select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    font-size: var(--text-sm);
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
}

.role-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.header-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-user:hover {
    background: var(--gray-100);
}

.header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: var(--text-sm);
}

.header-user-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-700);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    min-width: 200px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--gray-700);
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
    text-decoration: none;
}

.dropdown-divider {
    border-top: 1px solid var(--gray-200);
    margin: var(--space-1) 0;
}

/* ---- Alert / Flash Messages ---- */
.alert {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    animation: slideDown 0.3s ease;
}

.alert-icon {
    font-weight: 700;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.alert-message {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    cursor: pointer;
    opacity: 0.5;
    padding: 0 var(--space-1);
    transition: var(--transition-fast);
}

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

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

.alert-error {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid #FFCDD2;
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #FFE0B2;
}

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

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

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

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

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

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

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

.btn-secondary:hover {
    background: var(--secondary-dark);
    color: var(--white);
}

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

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    box-shadow: none;
    transform: none;
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
}

.form-label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--text-base);
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-error {
    border-color: var(--error);
}

.form-control.is-error:focus {
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--error);
    margin-top: var(--space-1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ---- Tables ---- */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: var(--text-sm);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

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

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

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.6;
}

.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-error   { background: var(--error-light); color: var(--error); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light); color: var(--info); }

/* ---- Pagination ---- */
.pagination {
    margin-top: var(--space-6);
    display: flex;
    justify-content: center;
}

.pagination-list {
    display: flex;
    gap: var(--space-1);
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    color: var(--gray-700);
    transition: var(--transition);
}

.pagination-link:hover {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

.pagination-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.pagination-ellipsis {
    display: flex;
    align-items: center;
    padding: 0 var(--space-2);
    color: var(--gray-400);
}

/* ---- Toggle Switch ---- */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--white);
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.empty-state h3 {
    font-size: var(--text-xl);
    color: var(--gray-600);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--text-sm);
    max-width: 400px;
    margin: 0 auto;
}

/* ---- Loading Spinner ---- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

/* ---- Tema Sınıfları ---- */
.theme-teacher .app-sidebar {
    background: linear-gradient(180deg, #0D47A1 0%, #1565C0 50%, #1976D2 100%);
}

.theme-student .app-sidebar {
    background: linear-gradient(180deg, #1B5E20 0%, #2E7D32 50%, #388E3C 100%);
}

.theme-observer .app-sidebar {
    background: linear-gradient(180deg, #BF360C 0%, #E65100 50%, #EF6C00 100%);
}

.theme-admin .app-sidebar {
    background: linear-gradient(180deg, #4A148C 0%, #6A1B9A 50%, #8E24AA 100%);
}

/* ---- Overlay (mobil sidebar) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ---- Animations ---- */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
        animation: slideInLeft 0.3s ease;
    }

    .app-main {
        margin-left: 0;
    }

    .hamburger-btn {
        display: flex;
    }

    .app-content {
        padding: var(--space-4);
    }

    .header-user-name {
        display: none;
    }

    .card-body {
        padding: var(--space-4);
    }
}

@media (max-width: 480px) {
    .app-content {
        padding: var(--space-3);
    }

    .btn {
        padding: var(--space-2) var(--space-4);
    }

    .card-header {
        padding: var(--space-3) var(--space-4);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
}

/* ---- Utility Classes ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mr-2 { margin-right: var(--space-2); }
.ml-2 { margin-left: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.d-flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.hidden { display: none !important; }
.visible { display: block !important; }
