/* ===================================
   AUTOCAD-STYLE SIDEBAR MENU
   Left vertical icon menu with expandable panels
   =================================== */

/* Top Header Bar - Minimal header with actions on right */
.top-header {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
}

.app-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Header Action Buttons (Kaydet, Undo, Redo, UI Toggle) */
.header-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

.header-action-btn svg {
    width: 18px;
    height: 18px;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-1px);
}

.header-action-btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.15);
}

.header-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.header-separator {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* User Info Buttons */
.header-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.header-btn.danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-color: #c0392b;
}

.header-btn.danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

/* Left Sidebar - AutoCAD Style Vertical Icons */
.left-sidebar {
    position: fixed;
    left: 0;
    top: 44px;
    bottom: var(--footer-height, 0px);
    width: 70px;
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 999;
}

.sidebar-icons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
}

.sidebar-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 6px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.75);
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-icon-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.sidebar-icon-btn span {
    font-size: 9px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.sidebar-icon-btn.active {
    background: rgba(52, 152, 219, 0.25);
    color: #3498db;
    border-left: 3px solid #3498db;
}

.sidebar-icon-btn.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #f8fafc;
}

/* Expandable Side Panel - Opens next to sidebar */
.ribbon-content {
    background: #f8fafc;
    border-right: 1px solid rgba(226, 232, 240, 0.2);
    box-shadow: 2px 0 8px rgba(0,0,0,0.08);
    position: fixed;
    left: 70px;
    top: 44px;
    bottom: var(--footer-height, 0px);
    width: 0;
    overflow: hidden;
    z-index: 998;
    transition: width 0.3s ease;
}

.ribbon-content.expanded {
    width: 240px;
}

/* Ribbon Panels */
.ribbon-panel {
    display: none;
    padding: 12px 10px;
    gap: 8px;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
}

.ribbon-panel.active {
    display: flex;
}

/* Ribbon Groups */
.ribbon-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 6px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

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

.ribbon-group-label {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    text-align: center;
}

/* Ribbon Buttons - Modern Style */
.ribbon-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 10px 14px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.ribbon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ribbon-btn:hover::before {
    opacity: 1;
}

.ribbon-btn svg {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    flex-shrink: 0 !important;
    color: #0284c7;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: block !important;
}

.ribbon-btn:hover {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #38bdf8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2), 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ribbon-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ribbon-btn:hover svg {
    color: #0ea5e9;
    transform: scale(1.15);
}

.ribbon-btn span {
    text-align: left;
    line-height: 1.3;
    flex: 1;
}

/* Ribbon Button Variants */
.ribbon-btn-small {
    padding: 8px 12px;
    font-size: 11px;
}

.ribbon-btn-large {
    padding: 14px 14px;
    justify-content: center;
}

.ribbon-btn-large svg {
    width: 28px;
    height: 28px;
}

.ribbon-btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border-color: #0284c7;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
    justify-content: flex-start;
}

.ribbon-btn-primary::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.ribbon-btn-primary:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border-color: #0369a1;
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
}

.ribbon-btn-primary svg {
    color: white !important;
    stroke: white !important;
}

.ribbon-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    justify-content: flex-start;
}

.ribbon-btn-danger::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.ribbon-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-color: #b91c1c;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.ribbon-btn-danger svg {
    color: white !important;
    stroke: white !important;
}

/* Toggle Buttons */
.ribbon-btn-toggle {
    position: relative;
}

.ribbon-btn-toggle.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.ribbon-btn-toggle.active::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.ribbon-btn-toggle.active:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: #047857;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.ribbon-btn-toggle.active svg {
    color: white;
}

.ribbon-btn-toggle.active:hover svg {
    transform: scale(1.15);
}

.ribbon-btn-toggle.active::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    background: rgba(0, 0, 0, 0.25);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Warning/Caution Button Variant */
.ribbon-btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-color: #d97706;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    justify-content: flex-start;
}

.ribbon-btn-warning::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.ribbon-btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    border-color: #b45309;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.ribbon-btn-warning svg {
    color: white !important;
    stroke: white !important;
}

/* Success Button Variant */
.ribbon-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    justify-content: flex-start;
}

.ribbon-btn-success::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.ribbon-btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-color: #047857;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.ribbon-btn-success svg {
    color: white !important;
    stroke: white !important;
}

/* Secondary/Ghost Button Variant */
.ribbon-btn-secondary {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ribbon-btn-secondary::before {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.05) 0%, rgba(71, 85, 105, 0.02) 100%);
}

.ribbon-btn-secondary:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.15);
}

.ribbon-btn-secondary svg {
    color: #64748b;
}

.ribbon-btn-secondary:hover svg {
    color: #475569;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ribbon-btn span {
        font-size: 11px;
    }

    .ribbon-btn {
        min-width: 70px;
        padding: 10px 12px;
    }

    .ribbon-tab {
        padding: 8px 16px;
        font-size: 12px;
    }
}

@media (max-width: 992px) {
    .ribbon-header {
        flex-wrap: wrap;
    }

    .ribbon-tabs {
        order: 2;
        width: 100%;
        padding: 0 8px 4px;
    }

    .quick-access-toolbar {
        order: 1;
    }

    .ribbon-user-area {
        order: 3;
        margin-left: auto;
    }

    .ribbon-btn {
        min-width: 60px;
        padding: 8px 10px;
    }

    .ribbon-btn span {
        font-size: 10px;
    }
}

@media (max-width: 768px) {
    .ribbon-panel {
        flex-direction: column;
    }

    .ribbon-group {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding: 8px;
    }

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

    .ribbon-btn {
        flex-direction: row;
        justify-content: flex-start;
        min-width: 100%;
        padding: 10px;
    }

    .ribbon-btn svg {
        width: 20px;
        height: 20px;
    }

    .qat-btn {
        width: 28px;
        height: 28px;
    }

    .qat-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Tablet Landscape Optimization */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .ribbon-content {
        max-height: 100px;
        overflow-y: auto;
    }

    .ribbon-panel {
        padding: 8px 12px;
    }

    .ribbon-btn {
        padding: 8px 10px;
        gap: 4px;
    }
}

/* High DPI Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ribbon-btn svg,
    .qat-btn svg {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print Styles */
@media print {
    .ribbon-header,
    .ribbon-content {
        display: none !important;
    }
}

/* Override toggle indicator content (fix encoding issue) */
.ribbon-btn-toggle.active::before {
    content: '✓';
}

/* ===================================
   HIDE OLD UI ELEMENTS
   =================================== */

/* Hide old floating buttons (now in ribbon) */
/* Hide old floating buttons (now in ribbon) */
#btnObjectLibrary {
    display: none !important;
}

/* Hide right properties panel (functionality moved to ribbon) */
.properties-panel {
    display: none !important;
}

/* Adjust main container to use full width */
.main-container {
    width: 100% !important;
}

.drawing-area {
    flex: 1;
    width: 100% !important;
}

/* Simple option row (label + checkbox) */
.ribbon-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 2px;
}

.ribbon-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

/* Keep vertical direction panel visible when pipe tool is active */
#vertical-direction-panel {
    /* This will still be visible when needed */
}

/* UI Compact Mode - SADECE footer gizle, header ve sidebar KAL */
body.ui-compact .top-header,
body.ui-compact .left-sidebar,
body.ui-compact .ribbon-content {
    /* Header ve sidebar her zaman görünür - gizleme! */
    display: flex !important;
}

/* Adjust body/canvas for fixed header and sidebar */
body {
    padding-top: 44px !important;
    padding-left: 70px !important;
}

/* UI compact modda da padding aynı kalır - menüler gizlenmiyor */
body.ui-compact {
    padding-top: 44px !important;
    padding-left: 70px !important;
}

/* Ensure sidebar is visible */
.left-sidebar {
    display: flex !important;
}

/* Main container adjustments */
.main-container {
    margin-left: 0 !important;
}

/* ===================================
   FLOATING MENUS Z-INDEX FIX
   Ensure floating menus appear above ribbon
   =================================== */

/* Tank floating menu */
#floating-tank-menu {
    z-index: 2000 !important;
}

/* Touch tank confirm menu */
#touch-tank-confirm-menu {
    z-index: 2001 !important;
}

/* Meter input container */
#meter-input-container {
    z-index: 2000 !important;
}

/* Tank modal overlay */
#tank-modal-overlay {
    z-index: 2100 !important;
}

/* Close mode button */
#btnCloseMode {
    z-index: 10000 !important;
}

/* Object Library Panel */
#objectLibraryPanel {
    z-index: 9999 !important;
}

.ribbon-panel[data-panel='dosya'] .ribbon-btn {
    justify-content: flex-start;
}

/* ===================================
   SIDEBAR PIN TOGGLE - Minimal Style
   =================================== */

.sidebar-pin-toggle {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 6px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-bottom: 8px;
}

.sidebar-pin-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-pin-toggle .pin-check {
    font-size: 9px;
    opacity: 0.3;
    transition: all 0.2s ease;
}

.sidebar-pin-toggle.active .pin-check {
    opacity: 1;
    color: #10b981;
}

.sidebar-pin-toggle:hover .pin-check {
    opacity: 0.6;
}

.sidebar-pin-toggle .pin-label {
    font-size: 8px;
    letter-spacing: 0.2px;
}

.sidebar-pin-toggle.active {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-pin-toggle.active:hover {
    color: rgba(255, 255, 255, 0.7);
}