/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
    padding-top: 80px; /* Adjust based on header height */
    padding-bottom: 40px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* Header */
header {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px; /* Adjust as needed */
}

header .logo {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}
header .logo:hover {
    text-decoration: none;
}

header ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

header ul a {
    color: #555;
    font-weight: 500;
}
header ul a:hover, header ul a.active {
    color: #007bff;
    text-decoration: none;
}
.nav-button {
    background: none;
    border: none;
    color: #555;
    font-weight: 500;
    cursor: pointer;
    font-size: 1em;
    padding: 0;
}
.nav-button:hover {
     color: #007bff;
}


/* Footer */
footer {
    background-color: #e9ecef;
    color: #6c757d;
    padding: 20px 0;
    text-align: center;
    margin-top: auto; /* Pushes footer to bottom */
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}
.form-group textarea {
    resize: vertical;
}

.form-group input[type="radio"],
.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

fieldset {
    border: 1px solid #ced4da;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

legend {
    padding: 0 0.5rem;
    font-weight: 500;
    color: #495057;
}

.radio-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: normal;
}

/* Buttons */
.button, button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    background-color: #6c757d; /* Default grey */
    color: #fff;
}
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-primary, button.button-primary {
    background-color: #007bff;
    color: #fff;
}
.button-primary:hover, button.button-primary:hover {
    background-color: #0056b3;
}

.button-danger, button.button-danger {
    background-color: #dc3545;
    color: #fff;
}
.button-danger:hover, button.button-danger:hover {
    background-color: #c82333;
}

.button-google {
    background-color: #fff;
    color: #444;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.button-google:hover {
    background-color: #f8f8f8;
}
.button-google img {
    vertical-align: middle;
}


/* Auth Page Specific */
.auth-container {
    max-width: 500px;
    margin-top: 40px;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.auth-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}
.auth-container hr {
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid #eee;
}
.auth-container p {
    text-align: center;
    margin-top: 1rem;
    color: #6c757d;
}

/* Dashboard & Account Specific */
.dashboard-container, .account-container {
    margin-top: 20px;
}
.dashboard-container h1, .account-container h1 {
    margin-bottom: 1.5rem;
}
.account-info p {
    margin-bottom: 0.75rem;
    font-size: 1.1em;
}
.account-info strong {
    min-width: 150px;
    display: inline-block;
}
.manage-subscription {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}
.manage-subscription h2 {
    margin-bottom: 1rem;
}

/* Image Editor */
.image-editor {
    margin-top: 2rem;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}
.image-editor h2 {
    margin-bottom: 1.5rem;
}
.editor-layout {
    display: flex;
    gap: 20px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}
.toolbar {
    flex: 0 0 250px; /* Fixed width for toolbar */
    border-right: 1px solid #eee;
    padding-right: 20px;
}
.toolbar h3 {
    margin-bottom: 1rem;
}
.tool-button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    text-align: left;
}
.tool-button.active {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: #000;
}
.toolbar hr {
    margin: 1rem 0;
}

.canvas-container {
    flex-grow: 1;
    position: relative;
    min-height: 300px; /* Ensure container has some height */
    background-color: #e9ecef; /* Placeholder background */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Ensure canvas doesn't overflow */
}
#upload-placeholder {
    color: #6c757d;
    text-align: center;
}
#editor-canvas {
    display: block; /* Remove extra space below canvas */
    max-width: 100%;
    max-height: 600px; /* Limit canvas height */
    object-fit: contain; /* Scale image within canvas bounds */
    cursor: crosshair; /* Default cursor for drawing */
}

/* Loading Indicator */
.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #09f;
    margin-top: 10px;
    animation: spin 1s ease infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Image Gallery */
#image-gallery-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}
#gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 1rem;
}
#gallery-grid img { /* Style for images within the gallery */
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* Make images square */
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#load-more-images {
    margin-top: 1.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}


/* Utility Classes */
.message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    display: none; /* Hidden by default */
    text-align: center;
}
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block; /* Show errors by default if they exist server-side */
     margin-bottom: 1rem;
}
.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.info-message {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Status indicators */
.status-active { color: #28a745; font-weight: bold; }
.status-inactive { color: #6c757d; }
.status-canceled { color: #ffc107; }
.status-past_due { color: #dc3545; font-weight: bold; }


/* Responsive Design */
@media (max-width: 768px) {
    main {
        padding-top: 70px; /* Adjust if header height changes */
    }
    header nav {
        height: 50px;
    }
    header ul {
        /* Consider a mobile menu toggle here */
        gap: 10px;
        font-size: 0.9em;
    }
    .editor-layout {
        flex-direction: column;
    }
    .toolbar {
        flex: 1 1 auto; /* Allow toolbar to take full width */
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
    .canvas-container {
        min-height: 250px;
    }
     #gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    .auth-container {
        padding: 20px;
    }
    .button, button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
     #gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
