/* AIU Web - Styles */

:root {
    --primary: #4a90d9;
    --primary-dark: #357abd;
    --secondary: #6c757d;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #343a40;
    --bg: #ffffff;
    --text: #212529;
    --border: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: var(--dark);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: var(--shadow);
}

.navbar-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 1rem;
}

.navbar-item {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.navbar-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 60px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Typography */
h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin: 1.5rem 0 1rem; }
h3 { font-size: 1.25rem; margin: 1rem 0 0.5rem; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* Graph Page */
.graph-container {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 1rem;
    height: calc(100vh - 150px);
}

.graph-controls {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.graph-view {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.graph-sidebar {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

/* Filter Panel */
.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary);
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Search */
.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.search-box button:hover {
    background: var(--primary-dark);
}

/* Record Cards */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.record-card {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.record-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.record-card a {
    text-decoration: none;
    color: inherit;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.record-type {
    background: var(--light);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--secondary);
}

.card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.card-preview {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* Relationships */
.relationship-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rel-section h4 {
    color: var(--secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.relationship-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--light);
    border-radius: 4px;
    font-size: 0.9rem;
}

.rel-type {
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.arrow {
    color: var(--secondary);
}

.target a {
    color: var(--primary);
    text-decoration: none;
}

.target a:hover {
    text-decoration: underline;
}

.target-type {
    color: var(--secondary);
    font-size: 0.8rem;
}

/* Node Detail */
.node-detail {
    padding: 1rem;
}

.node-detail.empty {
    color: var(--secondary);
    text-align: center;
    padding: 2rem;
}

.node-detail h3 {
    margin-bottom: 0.5rem;
}

.node-detail .meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.node-detail .body {
    font-size: 0.9rem;
    color: var(--secondary);
}

/* Utility */
.loading {
    color: var(--secondary);
    padding: 2rem;
    text-align: center;
}

.error {
    background: #f8d7da;
    color: var(--danger);
    padding: 1rem;
    border-radius: 4px;
}

.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

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

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

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

.login-subtitle {
    color: var(--secondary);
    margin-bottom: 2rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-input {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-input:disabled {
    background: var(--light);
    cursor: not-allowed;
}

.login-button {
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-button:hover {
    background: var(--primary-dark);
}

.login-button:disabled {
    background: var(--secondary);
    cursor: not-allowed;
}

.login-error {
    color: var(--danger);
    background: #f8d7da;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Navbar Right (logout/access level) */
.navbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.access-level {
    font-size: 0.8rem;
    background: rgba(255,255,255,0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
}

.logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .graph-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .graph-controls,
    .graph-sidebar {
        order: -1;
    }
}

@media (max-width: 600px) {
    .login-box {
        margin: 1rem;
        padding: 2rem;
    }

    .navbar {
        flex-wrap: wrap;
        padding: 1rem;
    }

    .navbar-right {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
}
