/* path:filename app/static/css/style.css */

/* Used for ensuring expanded elements are hidden when loading*/
[x-cloak] { display: none !important; }

/* General Styles */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Roboto', arial, sans-serif;
    box-sizing: border-box;
}

nav {
    position: sticky;
    top: 0;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

[x-cloak] {
    display: none;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-align: center;
}

/* Disabled button styles */
.btn:disabled {
    background-color: #ccc; /* Gray background for disabled state */
    color: #666; /* Lighter color for text */
    cursor: not-allowed; /* Change cursor to indicate disabled state */
    opacity: 0.6; /* Reduce opacity to visually differentiate */
    transform: none; /* Disable transform animations */
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-minor {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ced4da;
}

.btn-primary {
    background-color: #007bff;
    color: #ffffff;
    border: none;
}

.btn-secondary {
    background-color: #6c757d;
    color: #ffffff;
    border: none;
}

.btn-warning {
    background-color: #ffc107;
    color: #ffffff;
    border: none;
}

.btn-info {
    background-color: #17a2b8;
    color: #ffffff;
    border: none;
}

.btn-success {
    background-color: #28a745;
    color: #ffffff;
    border: none;
}

.btn-danger {
    background-color: #dc3545;
    color: #ffffff;
    border: none;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Hover and focus effect */
.btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Google Sign-In Button Styles */
.gsi-material-button {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-appearance: none;
    background-color: WHITE;
    background-image: none;
    border: 1px solid #747775;
    -webkit-border-radius: 20px;
    border-radius: 20px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    color: #1f1f1f;
    cursor: pointer;
    font-family: 'Roboto', arial, sans-serif;
    font-size: 14px;
    height: 40px;
    letter-spacing: 0.25px;
    outline: none;
    overflow: hidden;
    padding: 0 12px;
    position: relative;
    text-align: center;
    -webkit-transition: background-color .218s, border-color .218s, box-shadow .218s;
    transition: background-color .218s, border-color .218s, box-shadow .218s;
    vertical-align: middle;
    white-space: nowrap;
    width: auto;
    max-width: 400px;
    min-width: min-content;
}

.gsi-material-button .gsi-material-button-icon {
    height: 20px;
    margin-right: 12px;
    min-width: 20px;
    width: 20px;
}

.gsi-material-button .gsi-material-button-content-wrapper {
    -webkit-align-items: center;
    align-items: center;
    display: flex;
    -webkit-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: nowrap;
    flex-wrap: nowrap;
    height: 100%;
    justify-content: space-between;
    position: relative;
    width: 100%;
}

.gsi-material-button .gsi-material-button-contents {
    -webkit-flex-grow: 1;
    flex-grow: 1;
    font-family: 'Roboto', arial, sans-serif;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.gsi-material-button .gsi-material-button-state {
    -webkit-transition: opacity .218s;
    transition: opacity .218s;
    bottom: 0;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.gsi-material-button:disabled {
    cursor: default;
    background-color: #ffffff61;
    border-color: #1f1f1f1f;
}

.gsi-material-button:disabled .gsi-material-button-contents,
.gsi-material-button:disabled .gsi-material-button-icon {
    opacity: 38%;
}

.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus .gsi-material-button-state {
    background-color: #303030;
    opacity: 12%;
}

.gsi-material-button:not(:disabled):hover {
    -webkit-box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .30), 0 1px 3px 1px rgba(60, 64, 67, .15);
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .30), 0 1px 3px 1px rgba(60, 64, 67, .15);
}

.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
    background-color: #303030;
    opacity: 8%;
}

/* Flash Message Styles */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 300px;
}

.flash-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.5s ease-out;
}

.flash-message.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 5px solid #28a745;
}

.flash-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 5px solid #dc3545;
}

.flash-message.info {
    background-color: #cce5ff;
    color: #004085;
    border-left: 5px solid #0056b3;
}

.flash-message.warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 5px solid #ffc107;
}

.flash-icon {
    margin-right: 10px;
    font-size: 1.2em;
}

.flash-close {
    cursor: pointer;
    font-size: 1.2em;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.flash-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Invoice Preview Styles */
.invoice-preview-container {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.invoice-sidebar {
    width: 300px;
    padding: 1.5rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #333;
}

.action-group {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.action-item {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.action-item:hover {
    background-color: #e9ecef;
}

.action-item h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.action-item p {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.icon {
    width: 24px;
    height: 24px;
    margin-bottom: 0.5rem;
    color: #007bff;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.invoice-content {
    flex: 1;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
    margin-left: 2rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.invoice-header h1 {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.invoice-actions {
    display: flex;
    gap: 1rem;
}

.invoice-details {
    margin-top: 2rem;
}

.invoice-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.business-info, .invoice-meta {
    width: 48%;
}

.business-info h2, .invoice-meta h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: #333;
}

.logo-container {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.logo-container:not(:has(img)) {
    border: 2px dashed #ced4da;
}

.logo-container:hover {
    background-color: #e9ecef;
}

.logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-container span {
    color: #6c757d;
    font-weight: bold;
}

.customer-info {
    margin-bottom: 2rem;
}

.customer-info h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.invoice-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.invoice-items th, .invoice-items td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.invoice-items th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
}

.invoice-items tr:hover {
    background-color: #f8f9fa;
}

.invoice-items th:first-child,
.invoice-items td:first-child {
    width: 40%;
}

.invoice-items th:not(:first-child),
.invoice-items td:not(:first-child) {
    width: 20%;
}

.invoice-items td {
    vertical-align: top;
}

.item-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.item-description {
    font-size: 0.9rem;
    color: #6c757d;
}

.invoice-summary {
    margin-top: 2rem;
    border-top: 2px solid #dee2e6;
    padding-top: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.summary-item.payment {
    color: #28a745;
}

.summary-item.total {
    font-weight: bold;
    font-size: 1.2rem;
    margin-top: 1rem;
    border-top: 1px solid #dee2e6;
    padding-top: 0.5rem;
}

.invoice-notes, .invoice-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.invoice-notes h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.invoice-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.invoice-status.draft {
    background-color: #e9ecef;
    color: #495057;
}

.invoice-status.approved {
    background-color: #d4edda;
    color: #155724;
}

.invoice-status.sent {
    background-color: #cce5ff;
    color: #004085;
}

.invoice-status.paid {
    background-color: #d1e7dd;
    color: #0f5132;
}

.invoice-status.overdue {
    background-color: #f8d7da;
    color: #721c24;
}

/* Invoice Row Styles */
.invoice-row {
    cursor: pointer;
}

.invoice-row .invoice-actions a,
.invoice-row .invoice-actions [data-action="toggle-dropdown"] {
    cursor: pointer;
}

.invoice-row:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Discount/Tax Modal Styles */
#discountForm,
#taxForm,
.management-view {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.management-view.hidden,
#discountForm.hidden,
#taxForm.hidden {
    display: none !important;
}

/* Table Sorting */
.sort-btn {
    position: relative;
    cursor: pointer;
    padding-right: 15px;
}

.sort-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
}

.sort-btn::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    opacity: 0;
}

.sort-btn.sorting-asc::after {
    content: '▲';
    opacity: 1;
}

.sort-btn.sorting-desc::after {
    content: '▼';
    opacity: 1;
}

/* Customer Row Styles */
.customer-row {
    cursor: pointer;
}

.customer-row .customer-actions a,
.customer-row .customer-actions [data-action="toggle-dropdown"] {
    cursor: pointer;
}

.customer-row:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Account Row Styles */
.account-row {
    cursor: pointer;
}

.account-row .account-actions a,
.account-row .account-actions [data-action="toggle-dropdown"] {
    cursor: pointer;
}

.account-row:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .invoice-header {
        flex-direction: column;
    }

    .invoice-actions {
        margin-top: 1rem;
    }

    .invoice-preview-container {
        flex-direction: column;
    }

    .invoice-sidebar {
        width: 100%;
        margin-bottom: 2rem;
    }

    .invoice-content {
        margin-left: 0;
    }

    .invoice-info {
        flex-direction: column;
    }

    .business-info, .invoice-meta {
        width: 100%;
        margin-bottom: 1rem;
    }

    .invoice-items th:not(:first-child),
    .invoice-items td:not(:first-child) {
        width: auto;
    }
}

@media (max-width: 640px) {
    .dropdown-menu {
        right: auto;
        left: 0;
    }

    .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -6px;
        left: 10px;
        border-right: 6px solid transparent;
        border-bottom: 6px solid white;
        border-left: 6px solid transparent;
    }

    .dropdown-toggle.active + .dropdown-menu {
        display: block;
    }
}

/* Transitions for smooth theme switching */
.theme-transition * {
    transition: background-color 0.15s ease-in-out,
                color 0.15s ease-in-out,
                border-color 0.15s ease-in-out;
}

/* Prevent transition on page load */
.theme-transition-disabled * {
    transition: none !important;
}
