/* Floor Plan Builder - Main Stylesheet */

/* ===== VARIABLES ===== */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #495057;
    --border-color: #dee2e6;
    --text-color: #212529;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== RESET & BASE ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background: #fff;
    line-height: 1.6;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

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

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

.btn-secondary:hover {
    background: #5a6268;
}

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

.btn-danger:hover {
    background: #c82333;
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--light-gray);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

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

.btn .icon {
    margin-right: 0.25rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1rem;
}

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

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.2s;
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

textarea {
    resize: vertical;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
}

.checkbox-label input {
    width: auto;
    margin-right: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #e0e0e0;
    font-size: 0.875rem;
}

.radio-label:hover {
    background: #353535;
    border-color: #505050;
}

.radio-label input {
    width: auto;
    margin-right: 0.625rem;
    cursor: pointer;
}

/* Toolbar specific select styling */
.toolbar select {
    background: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #404040;
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar select:hover {
    background: #353535;
    border-color: #505050;
}

.toolbar select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.toolbar label {
    color: #e0e0e0;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== NAVBAR ===== */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.875rem;
}

.back-link:hover {
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user {
    color: var(--dark-gray);
    font-size: 0.875rem;
}

.nav-link {
    color: var(--dark-gray);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background 0.2s;
}

.nav-link:hover {
    background: var(--light-gray);
}

.save-status {
    padding: 0.375rem 0.75rem;
    background: var(--success-color);
    color: #fff;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.save-status.saving {
    background: var(--warning-color);
    color: var(--text-color);
}

/* ===== CONTAINER & LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

.page-header h2 {
    font-size: 1.75rem;
    color: var(--text-color);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

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

.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

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

.login-footer {
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.75rem;
}

/* ===== PLANS GRID ===== */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.plan-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.plan-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.plan-card-header {
    margin-bottom: 1rem;
}

.plan-card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.plan-card-meta {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.plan-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--secondary-color);
}

/* ===== EDITOR LAYOUT ===== */
.editor-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.editor-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.toolbar {
    width: 280px;
    background: #1e1e1e;
    border-right: 1px solid #333;
    padding: 1.25rem;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.tool-group {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #333;
}

.tool-group:last-child {
    border-bottom: none;
}

.tool-group h4 {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.875rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tool-btn,
.fixture-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 0.875rem;
    margin-bottom: 0.5rem;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 0.5rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    color: #e0e0e0;
    font-weight: 500;
}

.tool-btn .icon,
.fixture-btn .icon {
    font-size: 1.1rem;
    opacity: 0.9;
}

.tool-btn:hover,
.fixture-btn:hover {
    background: #007bff;
    color: #fff;
    border-color: #0056b3;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.tool-btn.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #fff;
    border-color: #004494;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0, 123, 255, 0.4);
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fafafa;
}

.canvas-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #fff;
    padding: 0.5rem;
    border-radius: 0.375rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

#zoom-level {
    font-size: 0.875rem;
    min-width: 50px;
    text-align: center;
}

.canvas-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

#editor-canvas,
#shared-canvas {
    display: block;
    cursor: crosshair;
}

.properties-panel {
    width: 280px;
    background: #1e1e1e;
    border-left: 1px solid #333;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
}

.properties-panel h3 {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#properties-content {
    margin-bottom: 2rem;
}

.property-group {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 0.5rem;
    padding: 1rem;
}

.property-group h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #007bff;
}

.property-group p {
    color: #e0e0e0;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.property-group strong {
    color: #888;
    font-weight: 600;
}

.property-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.help-text {
    color: #666;
    font-size: 0.875rem;
    font-style: italic;
}

.room-list {
    border-top: 1px solid #333;
    padding-top: 1.5rem;
}

.room-item {
    padding: 0.75rem;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 0.5rem;
    margin-bottom: 0.625rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.room-item:hover {
    background: #353535;
    border-color: #007bff;
    transform: translateX(-2px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.room-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #e0e0e0;
}

.room-sqft {
    font-size: 0.875rem;
    color: #888;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: var(--shadow);
    border-radius: 0.5rem;
    overflow: hidden;
}

.data-table thead {
    background: var(--light-gray);
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.875rem;
    text-transform: uppercase;
}

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

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

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
}

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

.badge-user {
    background: var(--secondary-color);
    color: #fff;
}

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

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

/* ===== SHARED VIEW ===== */
.shared-view {
    background: var(--light-gray);
}

.shared-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
}

.shared-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-view {
    background: #fff;
    border-radius: 0.5rem;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    box-shadow: var(--shadow-lg);
}

.plan-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.plan-header h2 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.plan-description {
    color: var(--secondary-color);
    line-height: 1.6;
}

.room-summary {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.room-summary table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.room-summary th,
.room-summary td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.room-summary th {
    background: var(--light-gray);
    font-weight: 600;
}

.room-summary .total-row {
    background: var(--light-gray);
}

.plan-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.error-message {
    text-align: center;
    padding: 3rem;
}

.error-message h2 {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

/* ===== PRINT STYLES ===== */
@media print {
    .no-print {
        display: none !important;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }

    .toolbar,
    .properties-panel {
        width: 100%;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
    }
}
