/* DocUp Global Styles */
/* Brand Color: #28a745 (Bootstrap Success Green) */

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #28a745;
}

html {
  position: relative;
  min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

a {
    color: #0066cc;
}

a:hover {
    color: #000080;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */

.login-page {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-page .header {
    background-color: #28a745;
    color: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
}

.login-page .header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.login-page .content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 1.5rem;
    font-weight: 400;
}

.login-box .form-label {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.login-box .form-control {
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 12px 20px;
    font-size: 1rem;
    margin-bottom: 20px;
}

.login-box .form-control:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15);
}

.btn-login {
    background-color: #28a745;
    border: none;
    color: white;
    padding: 12px 40px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: block;
    margin: 25px auto 15px;
}

.btn-login:hover {
    background-color: #218838;
}

.forgot-password {
    text-align: center;
    margin-top: 15px;
}

.forgot-password a {
    color: #218838;
    text-decoration: none;
    font-size: 0.9rem;
}

.forgot-password a:hover {
    text-decoration: underline;
}

.login-page .footer {
    background-color: #28a745;
    color: white;
    padding: 15px 30px;
    text-align: center;
    font-size: 0.85rem;
}

.login-page .footer a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
}

.login-page .footer a:hover {
    text-decoration: underline;
}

.login-box .alert {
    border-radius: 4px;
    margin-bottom: 20px;
}

/* ========================================
   LAYOUT STYLES
   ======================================== */

.header {
    background-color: #28a745;
    color: white;
    padding: 2.5px 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2px;
}

.header-icon {
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    text-decoration: none;
    position: relative;
}

.header-icon-badge {
    position: absolute;
    top: 1px;
    right: 2px;
    background-color: #1b7a2b;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    text-align: center;
    border-radius: 9px;
    padding: 0 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.header-icon:hover {
    color: white;
    text-decoration: none;
}

.header-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-icon.active {
    /* no background on active – only yellow icon */
}

.header-left .header-icon.active i {
    color: #FFD84D;
}

.header-left .header-icon:hover i {
    color: #FFD84D;
}

.header-right {
    display: flex;
    align-items: center;
}

.main-content {
    padding: 30px 20px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   INDEX PAGE STYLES
   ======================================== */

/* ========================================
   HEADER RESPONSIVE
   ======================================== */

@media (max-width: 576px) {
    .header-left {
        gap: 0 !important;
    }

    .header-icon {
        padding: 5px 6px !important;
    }
}


.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 0px solid #ddd;
}

.page-header h1 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
    font-weight: 600;
}

.register-picker {
    appearance: none;
    -webkit-appearance: none;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 32px 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.register-picker:hover {
    border-color: #aaa;
}

.register-picker:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.help-icon {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    font-weight: bold;
}

.section-title {
    font-size: 1.1rem;
    color: #333;
    margin: 30px 0 15px 0;
    font-weight: 500;
}

.data-table {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 30px;
    overflow-x: auto;
}

.data-table table {
    margin-bottom: 0;
}

.data-table thead th {
    background-color: white;
    border-bottom: 1px solid #ddd;
    color: #666;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 12px;
    text-align: center;
}

.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.company-name {
    text-align: left !important;
    color: #333;
    font-weight: 400;
}

.company-row.selected,
.data-table tbody tr.selected {
    background-color: #e3f2fd !important;
}

.count-badge {
    display: inline-block;
    min-width: 25px;
    padding: 2px 6px;
    text-align: center;
    border-radius: 3px;
    font-size: 0.85rem;
}

.count-badge.ank {
    background-color: #fff3cd;
}

.count-badge.sak {
    background-color: #cfe2ff;
}

.count-badge.att {
    background-color: #f8d7da;
}

.invoice-table tbody td {
    text-align: left;
}

.invoice-table tbody td:nth-child(2),
.invoice-table tbody td:nth-child(3),
.invoice-table tbody td:nth-child(4) {
    text-align: center;
}

.amount {
    text-align: right !important;
    font-family: 'Courier New', monospace;
}

.filter-row {
    padding: 10px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #ddd;
    font-size: 0.85rem;
}

.filter-row label {
    margin-right: 10px;
    color: #666;
}

/* ========================================
   HEADER USER MENU
   ======================================== */

.user-menu-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
    color: white;
}

.user-active-company {
    font-weight: 600;
    font-size: 0.8rem;
}

.user-display-name {
    font-size: 0.8rem;
}

.user-menu-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.9rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    line-height: 1;
}

.user-menu-btn:hover,
.user-menu-btn:focus {
    background-color: rgba(255, 255, 255, 0.15);
    outline: none;
    box-shadow: none;
}

.user-dropdown-menu {
    min-width: 280px;
    padding: 4px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    border: 1px solid #e0e0e0;
    border-radius: 0 0 4px 4px;
    margin-top: 2px !important;
}

.user-dropdown-menu li {
    border-bottom: 1px solid #f0f0f0;
}

.user-dropdown-menu li:last-child {
    border-bottom: none;
}

.user-dropdown-menu .dropdown-item {
    padding: 6px 16px;
    font-size: 0.9rem;
}

.user-dropdown-menu .dropdown-item.active,
.user-dropdown-menu .dropdown-item:active {
    background-color: transparent;
    color: inherit;
}

.dropdown-subitem {
    padding-left: 16px !important;
    font-size: 0.85rem !important;
    color: #555;
}

.dropdown-company-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    background-color: #f5f5f5;
}

.dropdown-company-manage {
    color: #aaa;
    text-decoration: none;
    font-size: 0.78rem;
}

.dropdown-company-manage:hover {
    color: #555;
}

.manage-company-icon {
    position: relative;
    display: inline-block;
}

.manage-company-plus {
    position: absolute;
    top: -4px;
    right: -6px;
    font-size: 0.55em;
    color: #aaa;
}

.dropdown-company-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    font-size: 0.84rem !important;
}

.dropdown-company-active {
    font-weight: 600;
    background-color: #f9fafb;
    border-left: 3px solid #28a745;
    padding-left: 13px !important; /* 16px default minus 3px border */
}

/* ========================================
   LAYOUT TOGGLE BUTTON
   ======================================== */

.layout-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    opacity: 0.75;
    line-height: 1;
}

.layout-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

/* Top-nav mode: visa sidebar-ikonen (för att byta TILL sidebar) */
.layout-icon-top {
    display: none;
}

/* Sidebar-mode: visa top-ikonen (för att byta TILL top-nav) */
body.layout-sidebar .layout-icon-sidebar {
    display: none;
}

body.layout-sidebar .layout-icon-top {
    display: inline;
}

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */

.sidebar {
    display: none;
}

body.layout-sidebar .header {
    display: none;
}

body.layout-sidebar .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    background-color: #28a745;
    z-index: 1030;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    letter-spacing: 0.3px;
    transition: background-color 0.2s;
}

.sidebar-brand:hover {
    color: rgba(255, 255, 255, 0.85);
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
    gap: 2px;
    flex: 1;
}

.sidebar-nav .header-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    text-align: left;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 1rem;
}

.sidebar-nav .header-icon i {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.sidebar-nav .header-icon:hover {
    text-decoration: none;
}

.sidebar-nav .header-icon:hover i,
.sidebar-nav .header-icon.active i {
    color: #FFD84D;
}

.sidebar-nav .header-icon span {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 4px;
}

.sidebar-nav-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 14px 2px;
}

.dropdown-register-group {
    list-style: none;
}

.dropdown-register-label {
    font-weight: 600 !important;
    color: #333 !important;
    cursor: default !important;
    pointer-events: none;
}

.dropdown-register-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-register-submenu .dropdown-item {
    padding-left: 40px !important;
}

.sidebar-bottom {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 8px 10px;
    gap: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.sidebar-user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.sidebar-user-company {
    font-size: 0.8rem;
    color: #6c757d;
}

.sidebar-user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px 22px;
    position: relative;
}

.sidebar-user-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 14px;
    right: 14px;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-user-header-icon {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: color 0.15s;
}

.sidebar-user-header-icon:hover {
    color: white;
    text-decoration: none;
}

.sidebar-company-switch-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.75rem;
    padding: 5px 7px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.sidebar-company-switch-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-user-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0;
    flex: 1;
}

.sidebar-user-header-company {
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-header-name {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.layout-sidebar .main-content {
    margin-left: 220px;
    margin-right: 0;
    max-width: none;
}

/* ----------------------------------------
   UNIVERSAL ALERT DIALOG
   ---------------------------------------- */
.app-alert-dialog {
    border: none;
    border-radius: 14px;
    padding: 0;
    max-width: 440px;
    width: calc(100vw - 2rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.app-alert-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.app-alert-dialog-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.5rem 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.app-alert-dialog-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
}

.app-alert-dialog-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #111;
}

.app-alert-dialog-body {
    padding: 1.1rem 1.5rem 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #374151;
    white-space: pre-line;
}

.app-alert-dialog-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1.5rem 1.25rem;
}

.app-alert-dialog-close {
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    padding: 8px 22px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    color: #374151;
    transition: background 0.15s;
}

.app-alert-dialog-close:hover {
    background: #e5e7eb;
}

.app-alert-dialog[data-type="error"] .app-alert-dialog-header {
    background: #fef2f2;
}
.app-alert-dialog[data-type="error"] .app-alert-dialog-icon { color: #ef4444; }
.app-alert-dialog[data-type="error"] .app-alert-dialog-title { color: #991b1b; }

.app-alert-dialog[data-type="warning"] .app-alert-dialog-header {
    background: #fffbeb;
}
.app-alert-dialog[data-type="warning"] .app-alert-dialog-icon { color: #f59e0b; }
.app-alert-dialog[data-type="warning"] .app-alert-dialog-title { color: #92400e; }

.app-alert-dialog[data-type="info"] .app-alert-dialog-header {
    background: #eff6ff;
}
.app-alert-dialog[data-type="info"] .app-alert-dialog-icon { color: #3b82f6; }
.app-alert-dialog[data-type="info"] .app-alert-dialog-title { color: #1e40af; }

.app-alert-dialog[data-type="success"] .app-alert-dialog-header {
    background: #f0fdf4;
}
.app-alert-dialog[data-type="success"] .app-alert-dialog-icon { color: #22c55e; }
.app-alert-dialog[data-type="success"] .app-alert-dialog-title { color: #166534; }

/* ========================================
   GLOBAL TOAST NOTIFICATION
   ======================================== */
.app-toast {
    position: fixed;
    top: 56px;
    right: max(20px, calc((100vw - 1400px) / 2 + 20px));
    z-index: 1050;
    min-width: 280px;
    max-width: 380px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.app-toast.app-toast--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.app-toast--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.app-toast--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}